String password = props.getProperty("password", null);
String token = props.getProperty("token", null);
// configure and create instance of CommandCenter that is used to communicate with LiveRebel Command Center
final CommandCenterFactory centerFactory = new CommandCenterFactory().setUrl(centerUrl, centerPort);
// use authentication token if it is set
if (token != null && token.trim().length() > 0) {
log.info("Using authentication token '{}' to connect to LiveRebel Command Center running on {}", token, centerAddress);
centerFactory.authenticate(token);
}
else {
log.info("Didn't find authentication token from {} file - using userName='{}' and password='{}' to connect to LiveRebel Command Center running on {}",
LR_CLI_PROPERTIES, userName, password, centerAddress);
centerFactory.authenticate(userName, password);
}
return centerFactory.newCommandCenter();
}