Skip to content

Commit b682737

Browse files
committed
Added needed custom port to API in the API itself (LDAP related)
Ticket: ENT-13612 Changelog: title
1 parent d2a424c commit b682737

File tree

1 file changed

+33
-16
lines changed

1 file changed

+33
-16
lines changed

cfe_internal/enterprise/CFE_hub_specific.cf

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -113,36 +113,53 @@ bundle agent update_cli_rest_server_url_config
113113
{
114114
vars:
115115
# Both share and live versions must be changed at once since httpd will be restarted later in the same agent run.
116-
"mp_config_file" string => "$(cfe_internal_hub_vars.docroot)/application/config/config.php";
117-
"mp_share_config_file" string => "$(sys.workdir)/share/GUI/application/config/config.php";
118-
"api_config_file" string => "$(cfe_internal_hub_vars.docroot)/api/modules/inventory/config/config.php";
116+
"mp_config_files" slist => {
117+
"application/config/config.php"
118+
};
119+
"api_config_files" slist => {
120+
"api/config/config.php",
121+
"api/modules/inventory/config/config.php"
122+
};
123+
124+
"share" string => "$(sys.workdir)/share/GUI";
125+
"docroot" string => "$(cfe_internal_hub_vars.docroot)";
126+
119127
"mp_test_pattern" string => ".*localhost:$(cfe_internal_hub_vars.https_port).*";
120128
"api_test_pattern" string => ".*127\.0\.0\.1:$(cfe_internal_hub_vars.https_port).*";
121129

122130
files:
123131
mpf_enable_mission_portal_docroot_sync_from_share_gui::
124-
"$(mp_share_config_file)"
125-
handle => "cfe_internal_edit_share_gui_mp_config",
132+
"$(share)/$(mp_config_files)"
133+
handle => canonify(concat("cfe_internal_edit_share_", "$(mp_config_files)")),
126134
edit_line => change_mp_server_url_port,
127135
if => and(
128-
fileexists("$(mp_share_config_file)"),
129-
islessthan(countlinesmatching("$(mp_test_pattern)", "$(mp_share_config_file)"), 1)
136+
fileexists("$(share)/$(mp_config_files)"),
137+
islessthan(countlinesmatching("$(mp_test_pattern)", "$(share)/$(mp_config_files)"), 1)
138+
);
139+
140+
"$(share)/$(api_config_files)"
141+
handle => canonify(concat("cfe_internal_edit_share_", "$(api_config_files)")),
142+
edit_line => change_api_server_url_port,
143+
if => and(
144+
fileexists("$(share)/$(api_config_files)"),
145+
islessthan(countlinesmatching("$(api_test_pattern)", "$(share)/$(api_config_files)"), 1)
130146
);
131147

132148
any::
133-
"$(mp_config_file)"
134-
handle => "cfe_internal_edit_mp_config",
149+
"$(docroot)/$(mp_config_files)"
150+
handle => canonify(concat("cfe_internal_edit_", "$(mp_config_files)")),
135151
edit_line => change_mp_server_url_port,
136152
if => and(
137-
fileexists("$(mp_config_file)"),
138-
islessthan(countlinesmatching("$(mp_test_pattern)", "$(mp_config_file)"), 1)
153+
fileexists("$(docroot)/$(mp_config_files)"),
154+
islessthan(countlinesmatching("$(mp_test_pattern)", "$(docroot)/$(mp_config_files)"), 1)
139155
);
140156

141-
"$(api_config_file)"
157+
"$(docroot)/$(api_config_files)"
158+
handle => canonify(concat("cfe_internal_edit_", "$(api_config_files)")),
142159
edit_line => change_api_server_url_port,
143160
if => and(
144-
fileexists("$(api_config_file)"),
145-
islessthan(countlinesmatching("$(api_test_pattern)", "$(api_config_file)"), 1)
161+
fileexists("$(docroot)/$(api_config_files)"),
162+
islessthan(countlinesmatching("$(api_test_pattern)", "$(docroot)/$(api_config_files)"), 1)
146163
);
147164
}
148165

@@ -156,8 +173,8 @@ bundle edit_line change_mp_server_url_port
156173
bundle edit_line change_api_server_url_port
157174
{
158175
replace_patterns:
159-
"^\s*define\(\"API_URL\",\s*\"https:\/\/127\.0\.0\.1(?::(?!$(cfe_internal_hub_vars.https_port))\d{1,5})?\/api\"\);\s*$"
160-
replace_with => value("define(\"API_URL\", \"https://127.0.0.1:$(cfe_internal_hub_vars.https_port)/api\");"),
176+
"https:\/\/127\.0\.0\.1(?::(?!$(cfe_internal_hub_vars.https_port))\d{1,5})?\/"
177+
replace_with => value("https://127.0.0.1:$(cfe_internal_hub_vars.https_port)/"),
161178
comment => "Change port API REST server URL port";
162179
}
163180

0 commit comments

Comments
 (0)