Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.

Commit 3a3cb55

Browse files
committed
#97 App services port can now be configured via mlAppServicesPort
1 parent f77b65f commit 3a3cb55

File tree

5 files changed

+25
-6
lines changed

5 files changed

+25
-6
lines changed

src/main/java/com/marklogic/appdeployer/AppConfig.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public class AppConfig {
6767

6868
private Integer restPort = DEFAULT_PORT;
6969
private Integer testRestPort;
70+
private Integer appServicesPort = 8000;
7071

7172
// These can all be set to override the default names that are generated off of the "name" attribute.
7273
private String groupName = DEFAULT_GROUP;
@@ -168,6 +169,9 @@ public XccAssetLoader newXccAssetLoader() {
168169
l.setUsername(getRestAdminUsername());
169170
l.setPassword(getRestAdminPassword());
170171
l.setDatabaseName(getModulesDatabaseName());
172+
if (getAppServicesPort() != null) {
173+
l.setPort(getAppServicesPort());
174+
}
171175

172176
String permissions = getModulePermissions();
173177
if (permissions != null) {
@@ -508,4 +512,12 @@ public Map<String, Integer> getForestCounts() {
508512
public void setForestCounts(Map<String, Integer> forestCounts) {
509513
this.forestCounts = forestCounts;
510514
}
515+
516+
public Integer getAppServicesPort() {
517+
return appServicesPort;
518+
}
519+
520+
public void setAppServicesPort(Integer appServicesPort) {
521+
this.appServicesPort = appServicesPort;
522+
}
511523
}

src/main/java/com/marklogic/appdeployer/DefaultAppConfigFactory.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ public AppConfig newAppConfig() {
6060
c.setTestRestPort(Integer.parseInt(prop));
6161
}
6262

63+
prop = getProperty("mlAppServicesPort");
64+
if (prop != null) {
65+
logger.info("App services port: " + prop);
66+
c.setAppServicesPort(Integer.parseInt(prop));
67+
}
68+
6369
prop = getProperty("mlRestAdminUsername");
6470
if (prop != null) {
6571
logger.info("REST admin username: " + prop);

src/main/java/com/marklogic/appdeployer/command/admin/SetSslFipsEnabledCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public SetSslFipsEnabledCommand(boolean sslFipsEnabled) {
1313

1414
@Override
1515
public void execute(CommandContext context) {
16-
context.getAdminManager().setSslFipsEnabled(sslFipsEnabled);
16+
context.getAdminManager().setSslFipsEnabled(sslFipsEnabled, context.getAppConfig().getAppServicesPort());
1717
}
1818

1919
public boolean isSslFipsEnabled() {

src/main/java/com/marklogic/mgmt/admin/AdminManager.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,25 +169,25 @@ private void waitForRestartInternal(int attempt) {
169169
}
170170

171171
/**
172-
* Set whether SSL FIPS is enabled on the cluster or not by running against /v1/eval on 8000.
172+
* Set whether SSL FIPS is enabled on the cluster or not by running against /v1/eval on the given appServicesPort.
173173
*/
174-
public void setSslFipsEnabled(final boolean enabled) {
174+
public void setSslFipsEnabled(final boolean enabled, final int appServicesPort) {
175175
final String xquery = "import module namespace admin = 'http://marklogic.com/xdmp/admin' at '/MarkLogic/admin.xqy'; "
176176
+ "admin:save-configuration(admin:cluster-set-ssl-fips-enabled(admin:get-configuration(), " + enabled
177177
+ "()))";
178178

179179
invokeActionRequiringRestart(new ActionRequiringRestart() {
180180
@Override
181181
public boolean execute() {
182-
RestTemplate rt = RestTemplateUtil.newRestTemplate(adminConfig.getHost(), 8000,
182+
RestTemplate rt = RestTemplateUtil.newRestTemplate(adminConfig.getHost(), appServicesPort,
183183
adminConfig.getUsername(), adminConfig.getPassword());
184184
HttpHeaders headers = new HttpHeaders();
185185
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
186186
MultiValueMap<String, String> map = new LinkedMultiValueMap<String, String>();
187187
map.add("xquery", xquery);
188188
HttpEntity<MultiValueMap<String, String>> entity = new HttpEntity<MultiValueMap<String, String>>(map,
189189
headers);
190-
String url = format("http://%s:8000/v1/eval", adminConfig.getHost());
190+
String url = format("http://%s:%d/v1/eval", adminConfig.getHost(), appServicesPort);
191191
if (logger.isInfoEnabled()) {
192192
logger.info("Setting SSL FIPS enabled: " + enabled);
193193
}
@@ -215,5 +215,4 @@ public void setWaitForRestartCheckInterval(int waitForRestartCheckInterval) {
215215
public void setWaitForRestartLimit(int waitForRestartLimit) {
216216
this.waitForRestartLimit = waitForRestartLimit;
217217
}
218-
219218
}

src/test/java/com/marklogic/appdeployer/DefaultAppConfigFactoryTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ public void allProperties() {
5757
p.setProperty("mlSimpleSsl", "anyvalue");
5858
p.setProperty("mlModulesDatabaseName", "my-modules");
5959
p.setProperty("mlGroupName", "other-group");
60+
p.setProperty("mlAppServicesPort", "8123");
6061

6162
sut = new DefaultAppConfigFactory(new SimplePropertySource(p));
6263
AppConfig config = sut.newAppConfig();
@@ -77,6 +78,7 @@ public void allProperties() {
7778
assertNotNull(config.getRestSslHostnameVerifier());
7879
assertEquals("my-modules", config.getModulesDatabaseName());
7980
assertEquals("other-group", config.getGroupName());
81+
assertEquals((Integer) 8123, config.getAppServicesPort());
8082
}
8183

8284
@Test

0 commit comments

Comments
 (0)