Skip to content

Commit cc811f7

Browse files
committed
fix: add more parameters to config command
1 parent 3ff301a commit cc811f7

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

Diff for: engine/cli/command_line_parser.cc

+8-3
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,7 @@ void CommandLineParser::SetupSystemCommands() {
657657
auto start_cmd = app_.add_subcommand("start", "Start the API server");
658658
start_cmd->group(kSystemGroup);
659659
cml_data_.port = std::stoi(cml_data_.config.apiServerPort);
660+
start_cmd->add_option("--host", cml_data_.server_host, "Server host");
660661
start_cmd->add_option("-p, --port", cml_data_.port, "Server port to listen");
661662
start_cmd->add_option("--loglevel", cml_data_.log_level,
662663
"Set up log level for server, accepted TRACE, DEBUG, "
@@ -671,10 +672,14 @@ void CommandLineParser::SetupSystemCommands() {
671672
start_cmd->callback([this] {
672673
if (std::exchange(executed_, true))
673674
return;
674-
if (cml_data_.port != stoi(cml_data_.config.apiServerPort)) {
675-
CTL_INF("apiServerPort changed from " << cml_data_.config.apiServerPort
676-
<< " to " << cml_data_.port);
675+
if (cml_data_.port != stoi(cml_data_.config.apiServerPort) ||
676+
cml_data_.server_host != cml_data_.config.apiServerHost) {
677+
CTL_INF("API server host:port changed from "
678+
<< cml_data_.config.apiServerHost << ":"
679+
<< cml_data_.config.apiServerPort << " to "
680+
<< cml_data_.server_host << ":" << cml_data_.port);
677681
auto config_path = file_manager_utils::GetConfigurationPath();
682+
cml_data_.config.apiServerHost = cml_data_.server_host;
678683
cml_data_.config.apiServerPort = std::to_string(cml_data_.port);
679684
auto result =
680685
config_yaml_utils::CortexConfigMgr::GetInstance().DumpYamlConfig(

Diff for: engine/cli/command_line_parser.h

+1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ class CommandLineParser {
7171

7272
bool show_menu = false;
7373

74+
std::string server_host;
7475
int port;
7576
config_yaml_utils::CortexConfig config;
7677
std::unordered_map<std::string, std::string> model_update_options;

0 commit comments

Comments
 (0)