@@ -40,6 +40,14 @@ bundle common cfe_internal_hub_vars
4040
4141 policy_server::
4242
43+ "http_port" -> { "ENT-12151" }
44+ string => ifelse( isvariable("cfe_internal_hub_vars.http_port"), "$(cfe_internal_hub_vars.http_port)", "80" ),
45+ comment => "Mission portal's webserver HTTP port. Default 80";
46+
47+ "https_port" -> { "ENT-12151" }
48+ string => ifelse( isvariable("cfe_internal_hub_vars.https_port"), "$(cfe_internal_hub_vars.https_port)", "443" ),
49+ comment => "Mission portal's webserver HTTPS port. Default 443";
50+
4351 "docroot" string => "$(sys.workdir)/httpd/htdocs",
4452 comment => "Root directory of Enterprise Web interface",
4553 handle => "cfe_internal_hub_vars_docroot";
@@ -91,6 +99,45 @@ bundle common cfe_internal_hub_vars
9199
92100}
93101
102+ ##################################################################
103+ #
104+ # update_cli_rest_server_url_config
105+ # - updates REST server URL port of Mission Portal WebGUI when
106+ # cfe_internal_hub_vars.https_port is changed
107+ #
108+ ##################################################################
109+ bundle agent update_cli_rest_server_url_config
110+ {
111+ vars:
112+ # Both share and live versions must be changed at once since httpd will be restarted later in the same agent run.
113+ "mp_config_file" string => "$(cfe_internal_hub_vars.docroot)/application/config/config.php";
114+ "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).*";
116+
117+ files:
118+ "$(mp_share_config_file)"
119+ edit_line => change_cli_rest_server_url_port,
120+ if => and(
121+ fileexists("$(mp_share_config_file)"),
122+ islessthan(countlinesmatching("$(regex_test_pattern)", "$(mp_share_config_file)"), 1)
123+ );
124+
125+ "$(mp_config_file)"
126+ edit_line => change_cli_rest_server_url_port,
127+ if => and(
128+ fileexists("$(mp_config_file)"),
129+ islessthan(countlinesmatching("$(regex_test_pattern)", "$(mp_config_file)"), 1)
130+ );
131+ }
132+
133+ bundle edit_line change_cli_rest_server_url_port
134+ {
135+ replace_patterns:
136+ "^\s*\$config\['cli_rest_server_url'\]\s*=\s*\"https://localhost(?::(?!$(cfe_internal_hub_vars.https_port))\d{1,5})?/api/\";\s*$"
137+ 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";
139+ }
140+
94141##################################################################
95142#
96143# cfe_internal_update_folders
0 commit comments