-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: tidying up CLI and file configuration for runtime config. Added…
… option for specifying the port
- Loading branch information
Showing
4 changed files
with
147 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,26 @@ | ||
#pragma once | ||
|
||
#include <Poco/Util/AbstractConfiguration.h> | ||
#include <filesystem> | ||
#include <optional> | ||
|
||
#include "silo/preprocessing/preprocessing_config.h" | ||
|
||
namespace silo_api { | ||
|
||
static const std::string DATA_DIRECTORY_OPTION = "dataDirectory"; | ||
static const std::string MAX_CONNECTIONS_OPTION = "maxQueuedHttpConnections"; | ||
static const std::string PARALLEL_THREADS_OPTION = "threadsForHttpConnections"; | ||
static const std::string PORT_OPTION = "port"; | ||
|
||
struct RuntimeConfig { | ||
std::optional<std::filesystem::path> data_directory; | ||
std::filesystem::path data_directory = silo::preprocessing::DEFAULT_OUTPUT_DIRECTORY.directory; | ||
uint32_t max_connections = 64; | ||
uint32_t parallel_threads = 4; | ||
uint16_t port = 8081; | ||
|
||
static RuntimeConfig readFromFile(const std::filesystem::path& config_path); | ||
void overwriteFromFile(const std::filesystem::path& config_path); | ||
void overwriteFromCommandLineArguments(const Poco::Util::AbstractConfiguration& config); | ||
}; | ||
|
||
} // namespace silo_api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters