From: Waldemar Kozaczuk <[email protected]>
Committer: Waldemar Kozaczuk <[email protected]>
Branch: master
Make httpserver-api configuration file configurable
Signed-off-by: Waldemar Kozaczuk <[email protected]>
---
diff --git a/modules/httpserver-api/global_server.cc
b/modules/httpserver-api/global_server.cc
--- a/modules/httpserver-api/global_server.cc
+++ b/modules/httpserver-api/global_server.cc
@@ -35,11 +35,8 @@ bool global_server::run(po::variables_map& _config)
if (get().s != nullptr) {
return false;
}
- //TODO: It would be nice to add config option that specifies location
- //of httpserver.conf. Also maybe the default location should be
/etc/httpserver.conf
- //but it seems that cloud-init module has some dependency on it -->
look at
- // modules/cloud-init/server-module.hh
- std::ifstream f("/tmp/httpserver.conf");
+ std::string config_file_path =
_config["config-file"].as<std::string>();
+ std::ifstream f(config_file_path);
if (f.is_open()) {
try {
YAML::Node doc = YAML::Load(f);
diff --git a/modules/httpserver-api/main.cc b/modules/httpserver-api/main.cc
--- a/modules/httpserver-api/main.cc
+++ b/modules/httpserver-api/main.cc
@@ -26,6 +26,7 @@ int main(int argc, char* argv[])
po::options_description desc("Allowed options");
desc.add_options()
("help", "produce help message")
+ ("config-file",
po::value<std::string>()->default_value("/tmp/httpserver.conf"), "configuration
file path")
("access-allow", po::value<std::string>(),
"Set the Access-Control-Allow-Origin to *. Note the security
risk")
("ipaddress", po::value<std::string>(), "set the ip address")
--
You received this message because you are subscribed to the Google Groups "OSv
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.