Skip to content

Commit

Permalink
avoid the use of system & environment properties; lets stick to regul…
Browse files Browse the repository at this point in the history
…ar IoC frameworks like blueprint/spring to configure things
  • Loading branch information
jstrachan committed May 17, 2013
1 parent f51d92b commit dad4fd4
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions hawtio-git/src/main/java/io/hawt/git/GitFacade.java
Expand Up @@ -65,7 +65,7 @@ public class GitFacade extends MBeanSupport implements GitFacadeMXBean {
private int shortCommitIdLength = 6;
private String remote = "origin";
private String defaultRemoteRepository = "https://github.com/hawtio/hawtio-config.git";
private Boolean cloneRemoteRepoOnStartup;
private boolean cloneRemoteRepoOnStartup = true;
private boolean pullOnStartup = true;
private CredentialsProvider credentials;
private boolean cloneAllBranches = false;
Expand Down Expand Up @@ -124,9 +124,6 @@ protected String getDefaultObjectName() {
}

public String getRemoteRepository() {
if (remoteRepository == null) {
remoteRepository = getSystemPropertyOrEnvironmentVariable("hawtio.config.repo", "HAWTIO_CONFIG_REPO");
}
if (remoteRepository == null) {
remoteRepository = defaultRemoteRepository;
}
Expand Down Expand Up @@ -194,10 +191,6 @@ public void setPullBeforeOperation(boolean pullBeforeOperation) {
}

public boolean isCloneRemoteRepoOnStartup() {
if (cloneRemoteRepoOnStartup == null) {
String flag = getSystemPropertyOrEnvironmentVariable("hawtio.config.cloneOnStartup", "HAWTIO_CONFIG_CLONEONSTARTUP");
cloneRemoteRepoOnStartup = flag == null || !flag.equals("false");
}
return cloneRemoteRepoOnStartup;
}

Expand Down Expand Up @@ -563,9 +556,6 @@ public File getConfigDirectory() {
if (configDirectory == null) {
try {
String name = getConfigDirName();
if (Strings.isBlank(name)) {
name = getSystemPropertyOrEnvironmentVariable("hawtio.config.dir", "HAWTIO_CONFIG_DIR");
}
if (Strings.isNotBlank(name)) {
configDirectory = new File(name);
} else {
Expand All @@ -591,14 +581,6 @@ public File getConfigDirectory() {
return configDirectory;
}

public String getSystemPropertyOrEnvironmentVariable(String systemPropertyName, String environmentVariableName) {
String name = System.getProperty(systemPropertyName);
if (name == null) {
name = System.getenv(environmentVariableName);
}
return name;
}

public void setConfigDirectory(File configDirectory) {
this.configDirectory = configDirectory;
}
Expand Down

0 comments on commit dad4fd4

Please sign in to comment.