com.capitalone.dashboard.collector.HudsonSettings Maven / Gradle / Ivy
package com.capitalone.dashboard.collector;
import java.util.List;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* Bean to hold settings specific to the Hudson collector.
*/
@Component
@ConfigurationProperties(prefix = "jenkins")
public class HudsonSettings {
private String cron;
private boolean saveLog = false;
private List servers;
private List niceNames;
//eg. DEV, QA, PROD etc
private List environments;
private List usernames;
private List apiKeys;
private String dockerLocalHostIP; //null if not running in docker on http://localhost
private int pageSize;
@Value("${folderDepth:10}")
private int folderDepth;
public String getCron() {
return cron;
}
public void setCron(String cron) {
this.cron = cron;
}
public boolean isSaveLog() {
return saveLog;
}
public void setSaveLog(boolean saveLog) {
this.saveLog = saveLog;
}
public List getServers() {
return servers;
}
public void setServers(List servers) {
this.servers = servers;
}
public List getUsernames() {
return usernames;
}
public void setUsernames(List usernames) {
this.usernames = usernames;
}
public List getApiKeys() {
return apiKeys;
}
public void setApiKeys(List apiKeys) {
this.apiKeys = apiKeys;
}
public void setDockerLocalHostIP(String dockerLocalHostIP) {
this.dockerLocalHostIP = dockerLocalHostIP;
}
public List getNiceNames() {
return niceNames;
}
public void setNiceNames(List niceNames) {
this.niceNames = niceNames;
}
public List getEnvironments() {
return environments;
}
public void setEnvironments(List environments) {
this.environments = environments;
}
//Docker NATs the real host localhost to 10.0.2.2 when running in docker
//as localhost is stored in the JSON payload from jenkins we need
//this hack to fix the addresses
public String getDockerLocalHostIP() {
//we have to do this as spring will return NULL if the value is not set vs and empty string
String localHostOverride = "";
if (dockerLocalHostIP != null) {
localHostOverride = dockerLocalHostIP;
}
return localHostOverride;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public int getPageSize() {
return pageSize;
}
public void setFolderDepth(int folderDepth) {
this.folderDepth = folderDepth;
}
public int getFolderDepth() {
return folderDepth;
}
}