Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update .cortexrc fields #1172

Merged
merged 1 commit into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions engine/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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();

Expand Down
13 changes: 6 additions & 7 deletions engine/utils/config_yaml_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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();
Expand All @@ -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<std::string>(),
.host = node["host"].as<std::string>(),
.port = node["port"].as<std::string>(),
.apiServerHost = node["apiServerHost"].as<std::string>(),
.apiServerPort = node["apiServerPort"].as<std::string>(),
};
return config;
} catch (const YAML::BadFile& e) {
Expand All @@ -60,5 +60,4 @@ inline CortexConfig FromYaml(const std::string& path,
}
}


} // namespace config_yaml_utils
4 changes: 2 additions & 2 deletions engine/utils/file_manager_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down
Loading