private String getPropertyFromEnvironment ( Key key ) { final String envVariable = key . getPropertyName ( ) . toUpperCase ( ) . replace ( "." , "_" ) ; try { return StringUtils . trimToNull ( System . getenv ( envVariable ) ) ; } catch ( SecurityException e ) { LOGGER . warn ( "A security exception prevented access to the environment variable. Using defaults." ) ; } catch ( NullPointerException e ) { // Do nothing. The key was not specified in an environment variable. Continue along. } return null ; }
Attempts to retrieve the key via environment variable . Property names are always upper case with periods replaced with underscores .