Deploy CLI Tool Environment Variables and Keyword Mappings

Using environment variables and keyword mappings with the Deploy CLI Tool allows you to:

  • Use the same configuration file for all of your environments (e.g., dev, uat, staging, and prod).

  • Replace certain values in your configuration repo with environment-specific values. To use the keyword mappings, you can wrap the key in two ways:

    • @@key@@: Using the @ symbols causes the tool to perform a JSON.stringify on your value before replacing it. So if your value is a string, the tool will add quotes; if your value is an array or object, the tool will add braces.

    • ##key##: Using the # symbol causes the tool to perform a literal replacement; it will not add quotes or brackets.

By default, the tool also merges your current environment variables and overrides AUTH0_KEYWORD_REPLACE_MAPPINGS that have the same top key. You can disable this via the command line with the --no-env option.

For example, you could specify a different JWT timeout in your dev environment, and then use prod for testing and a different environment URL.

Examples

Client.json

{
  ...
  "callbacks": [
    "##ENVIRONMENT_URL##/auth/callback"
  ],
  "jwt_configuration": {
    "lifetime_in_seconds": ##JWT_TIMEOUT##,
    "secret_encoded": true
  }
  ...
}
Dev Config.json

"AUTH0_KEYWORD_REPLACE_MAPPINGS": {
  "ENVIRONMENT_URL": "http://dev.travel0.com",
  "JWT_TIMEOUT": 120,
  ...
}

Prod Config.json

"AUTH0_KEYWORD_REPLACE_MAPPINGS": {
  "ENVIRONMENT_URL": "http://travel0.com",
  "JWT_TIMEOUT": 3600,
  ...
}

Learn more