• Document Up to Date
  • Updated On 4.1.0

Environment Variables Access

CrafterCMS supports a whitelisted list of variable names or patterns for a secure environment variables access. By default, custom environment variables prefixed by crafter_ are accessible using System.getenv(). If you wish to use a different prefix, or add other variable names to the whitelist, this may be configured in Studio, Engine and Deployer as shown below:

Studio configuration for environment variables whitelist - studio-config.yaml
# List of patterns for that is allowed to call as `staticMethod java.lang.System getenv java.lang.String` parameter (regexes separated by commas)
studio.scripting.sandbox.whitelist.getenvRegex: crafter_.*
Engine configuration for environment variables whitelist - server-config.properties
# List of patterns for that is allowed to call as `staticMethod java.lang.System getenv java.lang.String` parameter (regexes separated by commas)
crafter.engine.groovy.sandbox.whitelist.getenvRegex=crafter_.*
Deployer configuration for environment variables whitelist - application.yaml
 whitelist:
      # List of patterns for that is allowed to call as `staticMethod java.lang.System getenv java.lang.String` parameter (regexes separated by commas)
      getenvRegex: crafter_.*

See Environment Variables for more information on CrafterCMS default environment variables.