event loop with threadmgr
Some checks failed
Docker Build & Publish / build (push) Failing after 1h11m38s
Some checks failed
Docker Build & Publish / build (push) Failing after 1h11m38s
This commit is contained in:
parent
ca05aa1e5a
commit
058c395095
7 changed files with 2481 additions and 0 deletions
54
lib/config/config.hpp
Normal file
54
lib/config/config.hpp
Normal file
|
@ -0,0 +1,54 @@
|
|||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
#include <inttypes.h>
|
||||
#include <string>
|
||||
|
||||
namespace anthracite::config {
|
||||
class http_config {
|
||||
uint16_t _port;
|
||||
public:
|
||||
http_config(uint16_t port) : _port(port) {};
|
||||
virtual ~http_config() {};
|
||||
|
||||
uint16_t port() { return _port; }
|
||||
};
|
||||
|
||||
class https_config : public http_config {
|
||||
std::string _cert_path;
|
||||
std::string _key_path;
|
||||
public:
|
||||
https_config(uint16_t port, std::string cert_path, std::string key_path) :
|
||||
http_config(port), _cert_path(cert_path), _key_path(key_path) {};
|
||||
};
|
||||
|
||||
class config {
|
||||
uint16_t _worker_threads;
|
||||
std::optional<http_config> _http_config;
|
||||
std::optional<https_config> _https_config;
|
||||
|
||||
public:
|
||||
config(uint16_t worker_threads) : _worker_threads(worker_threads) {
|
||||
}
|
||||
|
||||
void add_http_config(http_config config) {
|
||||
_http_config = config;
|
||||
}
|
||||
|
||||
void add_https_config(https_config config) {
|
||||
_https_config = config;
|
||||
}
|
||||
|
||||
uint16_t worker_threads() {
|
||||
return _worker_threads;
|
||||
}
|
||||
|
||||
std::optional<http_config>& http_cfg() {
|
||||
return _http_config;
|
||||
}
|
||||
|
||||
std::optional<https_config>& https_cfg() {
|
||||
return _https_config;
|
||||
}
|
||||
};
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue