-
Notifications
You must be signed in to change notification settings - Fork 5
/
RestDbConfiguration.h
69 lines (62 loc) · 1.95 KB
/
RestDbConfiguration.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//
// Created by victor on 5/11/17.
//
#ifndef RESTDBXX_CONFIGURATION_H
#define RESTDBXX_CONFIGURATION_H
#include <string>
#include <memory>
#include <folly/dynamic.h>
namespace restdbxx {
class RestDbConfiguration {
private:
int http_port;
int https_port;
int spdy_port;
int h2_port;
std::string ip;
int threads;
std::string db_path;
std::string giphy_api_key;
std::string giphy_mount_path;
public:
const std::string &get_giphy_mount_path() const;
void set_giphy_mount_path(const std::string &giphy_mount_path);
private:
// file server endpoint;
bool file_server_enabled = false;
// endpoint path to access files
std::string file_server_path = {};
// filesystem directory served
std::string file_server_root = {};
public:
int getHttps_port() const;
void setHttps_port(int https_port);
const std::string &get_giphy_api_key() const;
void set_giphy_api_key(const std::string &giphy_api_key);
bool is_file_server_enabled() const;
void set_file_server_enabled(bool file_server_enabled);
const std::string &getFile_server_path() const;
void setFile_server_path(const std::string &file_server_path);
const std::string &getFile_server_root() const;
void setFile_server_root(const std::string &file_server_root);
RestDbConfiguration() = default;
virtual ~RestDbConfiguration() = default;
void loadConfiguration(const std::string &path);
void dumpConfiguration(const std::string &path);
int getHttp_port() const;
void setHttp_port(int http_port);
int getSpdy_port() const;
void setSpdy_port(int spdy_port);
int getH2_port() const;
void setH2_port(int h2_port);
const std::string &getIp() const;
void setIp(const std::string &ip);
int getThreads() const;
void setThreads(int threads);
const std::string &getDb_path() const;
void setDb_path(const std::string &db_path);
static std::shared_ptr<RestDbConfiguration> get_instance();
folly::dynamic buildJsonObject();
};
}
#endif //RESTDBXX_CONFIGURATION_H