# Class EnvironmentPropertySource

java.lang.Object
org.apache.tomcat.util.digester.EnvironmentPropertySource

All Implemented Interfaces:
  `IntrospectionUtils.PropertySource, IntrospectionUtils.SecurePropertySource`

public class EnvironmentPropertySource extends Object implements IntrospectionUtils.SecurePropertySource
A `IntrospectionUtils.SecurePropertySource` that uses environment variables to resolve expressions.

Usage example:

Configure the certificate with environment variables.

        <SSLHostConfig>
              <Certificate certificateKeyFile="${CERTIFICATE_KEY_FILE}"
                           certificateFile="${CERTIFICATE_FILE}"
                           certificateChainFile="${CERTIFICATE_CHAIN_FILE}"
                           type="RSA" />
        </SSLHostConfig>

How to configure:

      echo "org.apache.tomcat.util.digester.PROPERTY_SOURCE=org.apache.tomcat.util.digester.EnvironmentPropertySource" >> conf/catalina.properties

or add this to `CATALINA_OPTS`

      -Dorg.apache.tomcat.util.digester.PROPERTY_SOURCE=org.apache.tomcat.util.digester.EnvironmentPropertySource

NOTE: When configured the PropertySource for resolving expressions from system properties is still active.

See Also:
  - `Digester`
  - Tomcat Configuration Reference System Properties

## Constructor Summary

Constructors
Constructor
Description
`EnvironmentPropertySource()`
Default constructor for EnvironmentPropertySource.

## Method Summary

Modifier and Type
Method
Description
`String`
`getProperty(String key)`
Returns the value of the property with the specified key.
`String`
`getProperty(String key, ClassLoader classLoader)`
Obtain a property value, checking that code associated with the provided class loader has permission to access the property.

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### EnvironmentPropertySource

public EnvironmentPropertySource()
Default constructor for EnvironmentPropertySource.

## Method Details

### getProperty

public String getProperty(String key)
Description copied from interface: `IntrospectionUtils.PropertySource`
Returns the value of the property with the specified key.

Specified by:
  `getProperty` in interface `IntrospectionUtils.PropertySource`
Parameters:
  `key` - The property key
Returns:
  the property value, or `null` if not found

### getProperty

public String getProperty(String key, ClassLoader classLoader)
Description copied from interface: `IntrospectionUtils.SecurePropertySource`
Obtain a property value, checking that code associated with the provided class loader has permission to access the property. If the `classLoader` is `null` or if `classLoader` does not implement `PermissionCheck` then the property value will be looked up without a call to `PermissionCheck.check(java.security.Permission)`

Specified by:
  `getProperty` in interface `IntrospectionUtils.SecurePropertySource`
Parameters:
  `key` - The key of the requested property
  `classLoader` - The class loader associated with the code that trigger the property lookup
Returns:
  The property value or `null` if it could not be found or if `PermissionCheck.check(java.security.Permission)` fails