
io.sealights.agents.plugin.BasicConfigurationVerifier Maven / Gradle / Ivy
package io.sealights.agents.plugin;
import io.sealights.agents.plugin.Utils.StringUtils;
import io.sealights.agents.plugin.upgrade.utils.UserMessageHelper;
/**
* Created by Nadav on 9/1/2016.
*
* Should verify that all the basic configuration needed by Sealights, is present.
*/
public class BasicConfigurationVerifier {
private UserMessageHelper consoleLogger;
public BasicConfigurationVerifier(UserMessageHelper consoleLogger)
{
this.consoleLogger = consoleLogger;
}
public boolean isValidConfiguration(String token, String tokenFile, String customerId, String server, String appName, String buildSessionId, String buildSessionIdFile){
boolean isValid = true;
if (StringUtils.isNullOrEmpty(token) && StringUtils.isNullOrEmpty(tokenFile)){
if (StringUtils.isNullOrEmpty(customerId)){
consoleLogger.printError("The 'customerId' property is missing. Please provide a valid customer ID. If you don't have one, please contact [email protected]");
isValid = false;
}
if (StringUtils.isNullOrEmpty(server)){
consoleLogger.printError("The 'server' property is missing. Please provide a server URL.");
isValid = false;
}
}
if (StringUtils.isNullOrEmpty(appName) && StringUtils.isNullOrEmpty(buildSessionId) && StringUtils.isNullOrEmpty(buildSessionIdFile)){
consoleLogger.printError("The 'buildSessionId' and the 'appName' properties are missing. Please provide at least one of them.");
isValid = false;
}
if (!isValid){
consoleLogger.printError("Please fix the above error(s). Sealights is disabled.");
}
return isValid;
}
private static boolean isSealightsEnabled() {
String value = System.getProperty("sl.enabled");
return !"false".equalsIgnoreCase(value);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy