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

Commit 8f27bc1

Browse files
committed
Throwing in a few defaults on AppConfig
1 parent 616e03b commit 8f27bc1

File tree

2 files changed

+34
-9
lines changed

2 files changed

+34
-9
lines changed

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

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,25 @@
2727
*/
2828
public class AppConfig {
2929

30+
/**
31+
* This is set purely for development purposes so that an app can be created without specifying an app name.
32+
*/
33+
public static final String DEFAULT_APP_NAME = "my-app";
34+
35+
/**
36+
* These are assumed as sensible defaults in a development environment, where teams often use admin/admin for the
37+
* admin login. They are of course expected to change in a real environment.
38+
*/
39+
public static final String DEFAULT_USERNAME = "admin";
40+
public static final String DEFAULT_PASSWORD = "admin";
41+
42+
/**
43+
* This is set purely for development purposes so that an app can be configured without specifying a port. The
44+
* v1/rest-apis endpoint will select an open port if none is provided, but some work is then required to figure out
45+
* what that port is before modules are loaded.
46+
*/
47+
public static final Integer DEFAULT_PORT = 8003;
48+
3049
/**
3150
* The default path from which modules will be loaded into a modules database.
3251
*/
@@ -35,20 +54,21 @@ public class AppConfig {
3554
public final static String DEFAULT_HOST = "localhost";
3655
public final static String DEFAULT_GROUP = "Default";
3756

38-
private String name;
57+
private String name = DEFAULT_APP_NAME;
3958
private String host = DEFAULT_HOST;
4059

4160
// Username/password combo for using the client REST API - e.g. to load modules
42-
private String restAdminUsername;
43-
private String restAdminPassword;
61+
private String restAdminUsername = DEFAULT_USERNAME;
62+
private String restAdminPassword = DEFAULT_PASSWORD;
4463
private SSLContext restSslContext;
4564
private SSLHostnameVerifier restSslHostnameVerifier;
4665
private Authentication restAuthentication = Authentication.DIGEST;
4766

48-
private Integer restPort;
67+
private Integer restPort = DEFAULT_PORT;
4968
private Integer testRestPort;
5069

51-
// These can all be set to override the default names
70+
// These can all be set to override the default names that are generated off of the "name" attribute.
71+
private String groupName = DEFAULT_GROUP;
5272
private String restServerName;
5373
private String testRestServerName;
5474
private String contentDatabaseName;
@@ -60,8 +80,6 @@ public class AppConfig {
6080
private List<String> modulePaths;
6181
private ConfigDir configDir;
6282

63-
private String groupName = DEFAULT_GROUP;
64-
6583
// Passed into the TokenReplacer that subclasses of AbstractCommand use
6684
private Map<String, String> customTokens = new HashMap<>();
6785

src/main/java/com/marklogic/mgmt/ManageConfig.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,22 @@
99
*/
1010
public class ManageConfig extends RestConfig {
1111

12+
/**
13+
* These are assumed as sensible defaults in a development environment, where teams often use admin/admin for the
14+
* admin login. They are of course expected to change in a real environment.
15+
*/
16+
public static final String DEFAULT_USERNAME = "admin";
17+
public static final String DEFAULT_PASSWORD = "admin";
18+
1219
private String adminUsername;
1320
private String adminPassword;
1421

1522
public ManageConfig() {
16-
this("localhost", "admin");
23+
this("localhost", DEFAULT_PASSWORD);
1724
}
1825

1926
public ManageConfig(String host, String password) {
20-
this(host, 8002, "admin", password);
27+
this(host, 8002, DEFAULT_USERNAME, password);
2128
}
2229

2330
public ManageConfig(String host, int port, String username, String password) {

0 commit comments

Comments
 (0)