Skip to content

Commit

Permalink
update env var in docs. Might help with #88 (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevezau authored and fyockm committed Feb 21, 2019
1 parent 0612c27 commit 617c699
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 15 deletions.
18 changes: 12 additions & 6 deletions examples/directory/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This README will document how to use the Directory Option of the Auth0-deploy-cli tool. Please refer to the [README.md](README.md) for more information on the Auth0 Deploy CLI.

# Organize your repository
# Overview
The directory option supports exporting and importing the Auth0 tenant configuration into a pre-defined directory structure.

There is more extensive documentation online for how the files are expected to be laid out to work with the source control configuration utilities [here](https://auth0.com/docs/extensions/github-deploy).
Expand Down Expand Up @@ -70,7 +70,7 @@ You can export your current tenant configuration. For example the following comm

## Example Import
Included in this directory is an example structure.
Included in this GitHub directory is an example structure.

### Instructions

Expand All @@ -85,7 +85,7 @@ a0deploy import -c config.json -i .
## Config
The config will need the client ID and secret from your newly created client (the client is named `auth0-deploy-cli-extension` if you used the extension).

You can either set env variables or place the values in a config file anywhere on the filesystem.
You can either set environment variables (ie in your terminal) or place the values in a config file anywhere on the filesystem.

> NOTE: By default the tool will also merge in your current environment variables and override the config.json which have the same top key. You can disable this via the command line with the `--no-env` option.
Expand All @@ -111,10 +111,16 @@ Here is the example of a config.json:
}
```

## ENV Variables and AUTH0_KEYWORD_REPLACE_MAPPINGS
The mappings are there so that you can use the same configuration file for all of your environments (e.g. dev, uat, staging, and prod) without having to have different versions of the files for each environment. The mappings allow you to replace certain values in your configuration repo with envrionment specic values. There are two ways to use the keyword mappings. You can either wrap the key in `@@key@@` or `##key##`. If you use the `@` symbols, it will do a JSON.stringify on your value before replacing it. So if it is a string it will add quotes, if it is an array or object it will add braces. If you use the `#` symbol instead, till just do a literal replacement. It will not add quotes or brackets.
## Environment Variables and AUTH0_KEYWORD_REPLACE_MAPPINGS
The `auth0-deploy-cli` supports environment variables replacements, also known as mappings. This means you can deploy the same Auth0 Tenant configuration across your environments (i.e. dev, uat, staging, and prod). The tool will automatically inject the right values for each environment (i.e callback urls).

> NOTE: By default the tool will also merge in your current environment variables and override the AUTH0_KEYWORD_REPLACE_MAPPINGS which have the same top key. You can disable this via the command line with the `--no-env` option.
Environment variables can be set on the terminal and within the `config.json`. At run time the variables defined in your terminal and `config.json` will be merged. You can disable this via the command line with the `--no-env` option. The terminal variables will take priority over `config.json`

There are two ways to use the keyword mappings in your Auth0 Tenant configuration files. You can inject values using `@@key@@` or `##key##`.

If you use the `@` symbols, it will do a JSON.stringify on your value before replacing it. So if it is a string it will add quotes, if it is an array or object it will add braces.

If you use the `#` symbol instead, it will do a literal replacement. It will not add quotes or brackets.

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

Expand Down
24 changes: 15 additions & 9 deletions examples/yaml/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ You can export your current tenant configuration. For example the following comm
## Example Import
Please refer to [tenant.yaml](tenant.yaml) for an example configuration.

###Instructions
### Instructions

1. Copy config.json.example and fill out details
2. Run deploy
Expand All @@ -32,7 +32,7 @@ a0deploy import -c config.json -i tenant.yaml
## Config
The config will need the client ID and secret from your newly created client (the client is named `auth0-deploy-cli-extension` if you used the extension).

You can either set env variables or place the values in a config file anywhere on the filesystem.
You can either set environment variables (ie in your terminal) or place the values in a config file anywhere on the filesystem.

> NOTE: By default the tool will also merge in your current environment variables and override the config.json which have the same top key. You can disable this via the command line with the `--no-env` option.
Expand All @@ -54,17 +54,23 @@ Here is the example of a config.json:
}
```

## ENV Variables and AUTH0_KEYWORD_REPLACE_MAPPINGS
The mappings are there so that you can use the same configuration file for all of your environments (e.g. dev, uat, staging, and prod) without having to have different versions of the files for each environment. The mappings allow you to replace certain values in your configuration repo with envrionment specic values. There are two ways to use the keyword mappings. You can either wrap the key in `@@key@@` or `##key##`. If you use the `@` symbols, it will do a JSON.stringify on your value before replacing it. So if it is a string it will add quotes, if it is an array or object it will add braces. If you use the `#` symbol instead, till just do a literal replacement. It will not add quotes or brackets.
## Environment Variables and AUTH0_KEYWORD_REPLACE_MAPPINGS
The `auth0-deploy-cli` supports environment variables replacements, also known as mappings. This means you can deploy the same Auth0 Tenant configuration across your environments (i.e. dev, uat, staging, and prod). The tool will automatically inject the right values for each environment (i.e callback urls).

> NOTE: By default the tool will also merge in your current environment variables and override the AUTH0_KEYWORD_REPLACE_MAPPINGS which have the same top key. You can disable this via the command line with the `--no-env` option.
Environment variables can be set on the terminal and within the `config.json`. At run time the variables defined in your terminal and `config.json` will be merged. You can disable this via the command line with the `--no-env` option. The terminal variables will take priority over `config.json`

There are two ways to use the keyword mappings in your Auth0 Tenant configuration files. You can inject values using `@@key@@` or `##key##`.

If you use the `@` symbols, it will do a JSON.stringify on your value before replacing it. So if it is a string it will add quotes, if it is an array or object it will add braces.

If you use the `#` symbol instead, it will do a literal replacement. It will not add quotes or brackets.

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

Client .json:
Client.json:
```json
{
...
...
"callbacks": [
"##ENVIRONMENT_URL##/auth/callback"
],
Expand All @@ -76,7 +82,7 @@ Client .json:
}
```

Dev Config .json:
Dev Config.json:
```json
"AUTH0_KEYWORD_REPLACE_MAPPINGS": {
"ENVIRONMENT_URL": "http://dev.fabrikam.com",
Expand All @@ -85,7 +91,7 @@ Dev Config .json:
}
```

Prod Config .json:
Prod Config.json:
```json
"AUTH0_KEYWORD_REPLACE_MAPPINGS": {
"ENVIRONMENT_URL": "http://fabrikam.com",
Expand Down

0 comments on commit 617c699

Please sign in to comment.