diff --git a/engine/main.cc b/engine/main.cc index 5c83d1103..1f403d869 100644 --- a/engine/main.cc +++ b/engine/main.cc @@ -26,7 +26,7 @@ void RunServer() { auto config = file_manager_utils::GetCortexConfig(); - LOG_INFO << "Host: " << config.host << " Port: " << config.port << "\n"; + LOG_INFO << "Host: " << config.apiServerHost << " Port: " << config.apiServerPort << "\n"; // Create logs/ folder and setup log to file std::filesystem::create_directory(cortex_utils::logs_folder); @@ -66,10 +66,10 @@ void RunServer() { LOG_INFO << "cortex.cpp version: undefined"; #endif - LOG_INFO << "Server started, listening at: " << config.host << ":" - << config.port; + LOG_INFO << "Server started, listening at: " << config.apiServerHost << ":" + << config.apiServerPort; LOG_INFO << "Please load your model"; - drogon::app().addListener(config.host, std::stoi(config.port)); + drogon::app().addListener(config.apiServerHost, std::stoi(config.apiServerPort)); drogon::app().setThreadNum(drogon_thread_num); LOG_INFO << "Number of thread is:" << drogon::app().getThreadNum(); diff --git a/engine/utils/config_yaml_utils.h b/engine/utils/config_yaml_utils.h index 4330f3527..99db396cb 100644 --- a/engine/utils/config_yaml_utils.h +++ b/engine/utils/config_yaml_utils.h @@ -9,8 +9,8 @@ namespace config_yaml_utils { struct CortexConfig { std::string dataFolderPath; - std::string host; - std::string port; + std::string apiServerHost; + std::string apiServerPort; }; const std::string kCortexFolderName = "cortexcpp"; @@ -28,8 +28,8 @@ inline void DumpYamlConfig(const CortexConfig& config, } YAML::Node node; node["dataFolderPath"] = config.dataFolderPath; - node["host"] = config.host; - node["port"] = config.port; + node["apiServerHost"] = config.apiServerHost; + node["apiServerPort"] = config.apiServerPort; out_file << node; out_file.close(); @@ -50,8 +50,8 @@ inline CortexConfig FromYaml(const std::string& path, auto node = YAML::LoadFile(config_file_path.string()); CortexConfig config = { .dataFolderPath = node["dataFolderPath"].as(), - .host = node["host"].as(), - .port = node["port"].as(), + .apiServerHost = node["apiServerHost"].as(), + .apiServerPort = node["apiServerPort"].as(), }; return config; } catch (const YAML::BadFile& e) { @@ -60,5 +60,4 @@ inline CortexConfig FromYaml(const std::string& path, } } - } // namespace config_yaml_utils diff --git a/engine/utils/file_manager_utils.h b/engine/utils/file_manager_utils.h index d20a39f13..e0bce0ca6 100644 --- a/engine/utils/file_manager_utils.h +++ b/engine/utils/file_manager_utils.h @@ -136,8 +136,8 @@ inline void CreateConfigFileIfNotExist() { auto config = config_yaml_utils::CortexConfig{ .dataFolderPath = defaultDataFolderPath.string(), - .host = config_yaml_utils::kDefaultHost, - .port = config_yaml_utils::kDefaultPort, + .apiServerHost = config_yaml_utils::kDefaultHost, + .apiServerPort = config_yaml_utils::kDefaultPort, }; DumpYamlConfig(config, config_path.string()); }