public static ConnectionConfig getConnectionConfig ( ) { boolean isValid = true ; String appdUsername = getPropertyOrEnv ( "com.signalfx.appd.username" , "APPD_USERNAME" ) ; if ( StringUtils . isEmpty ( appdUsername ) ) { log . error ( "AppDynamics username not specified." ) ; isValid = false ; } String appdPassword = getPropertyOrEnv ( "com.signalfx.appd.password" , "APPD_PASSWORD" ) ; if ( StringUtils . isEmpty ( appdPassword ) ) { log . error ( "AppDynamics password not specified." ) ; isValid = false ; } String appdURL = getPropertyOrEnv ( "com.signalfx.appd.host" , "APPD_HOST" ) ; if ( StringUtils . isEmpty ( appdURL ) ) { log . error ( "AppDynamics host not specified." ) ; isValid = false ; } String fxToken = getPropertyOrEnv ( "com.signalfx.api.token" , "SIGNALFX_TOKEN" ) ; if ( StringUtils . isEmpty ( fxToken ) ) { log . error ( "SignalFx token not specified." ) ; isValid = false ; } if ( isValid ) { return new ConnectionConfig ( appdUsername , appdPassword , appdURL , fxToken ) ; } else { return null ; } }
Retrieve configurations by looking up in property param first then environment variable .