@@ -112,30 +112,46 @@ bundle agent update_cli_rest_server_url_config
112112 # Both share and live versions must be changed at once since httpd will be restarted later in the same agent run.
113113 "mp_config_file" string => "$(cfe_internal_hub_vars.docroot)/application/config/config.php";
114114 "mp_share_config_file" string => "$(sys.workdir)/share/GUI/application/config/config.php";
115- "regex_test_pattern" string => ".*localhost:$(cfe_internal_hub_vars.https_port).*";
115+ "api_config_file" string => "$(cfe_internal_hub_vars.docroot)/api/modules/inventory/config/config.php";
116+ "mp_test_pattern" string => ".*localhost:$(cfe_internal_hub_vars.https_port).*";
117+ "api_test_pattern" string => ".*127.0.0.1:$(cfe_internal_hub_vars.https_port).*";
116118
117119 files:
118120 "$(mp_share_config_file)"
119121 edit_line => change_cli_rest_server_url_port,
120122 if => and(
121123 fileexists("$(mp_share_config_file)"),
122- islessthan(countlinesmatching("$(regex_test_pattern )", "$(mp_share_config_file)"), 1)
124+ islessthan(countlinesmatching("$(mp_test_pattern )", "$(mp_share_config_file)"), 1)
123125 );
124126
125127 "$(mp_config_file)"
126128 edit_line => change_cli_rest_server_url_port,
127129 if => and(
128130 fileexists("$(mp_config_file)"),
129- islessthan(countlinesmatching("$(regex_test_pattern )", "$(mp_config_file)"), 1)
131+ islessthan(countlinesmatching("$(mp_test_pattern )", "$(mp_config_file)"), 1)
130132 );
133+
134+ "$(api_config_file)"
135+ edit_line => change_cli_rest_server_url_port,
136+ if => and(
137+ fileexists("$(api_config_file)"),
138+ islessthan(countlinesmatching("$(api_test_pattern)", "$(api_config_file)"), 1)
139+ );
131140}
132141
133- bundle edit_line change_cli_rest_server_url_port
142+ bundle edit_line change_mp_server_url_port
134143{
135144 replace_patterns:
136145 "^\s*\$config\['cli_rest_server_url'\]\s*=\s*\"https://localhost(?::(?!$(cfe_internal_hub_vars.https_port))\d{1,5})?/api/\";\s*$"
137146 replace_with => value(" $config['cli_rest_server_url'] = \"https://localhost:$(cfe_internal_hub_vars.https_port)/api/\";"),
138- comment => "Change port CLI REST server URL port";
147+ comment => "Change port MP REST server URL port";
148+ }
149+ bundle edit_line change_api_server_url_port
150+ {
151+ replace_patterns:
152+ "^\s*\$define\(\"API_URL\",\s*\"https://127.0.0.1(?::(?!$(cfe_internal_hub_vars.https_port))\d{1,5})?/api/\"\);\s*$"
153+ replace_with => value("define(\"API_URL\", \"https://127.0.0.1:$(cfe_internal_hub_vars.https_port)/api/\");"),
154+ comment => "Change port API REST server URL port";
139155}
140156
141157##################################################################
0 commit comments