docs/maintainers/handbook.md aktualisiert
Thats how I until now understood process of adding an env var. Thought it might help other's who are new. I am very open to suggestions, other best practices, corrected typos...
This commit is contained in:
parent
a492386ce3
commit
1618faa420
@ -124,6 +124,43 @@ You can also access it in your configs using the following syntax:
|
||||
{{ env "FOO" }}
|
||||
```
|
||||
|
||||
### Example: Adding environment variables to existing recipe
|
||||
Here is a four step example how to add a new environment variable to a recipe without breaking existing deployments.
|
||||
|
||||
1. add env-var to the `compose.yml` in section `environment`:
|
||||
```yaml
|
||||
environment:
|
||||
# ... existing envs
|
||||
- REQUIRE_AUTH_FOR_PROFILE_REQUESTS=${REQUIRE_AUTH_FOR_PROFILE_REQUESTS:-false}
|
||||
# ... other existing envs
|
||||
```
|
||||
|
||||
With `${REQUIRE_AUTH_FOR_PROFILE_REQUESTS:-false}` you set a default value (`false`), ensuring not to break existing deployments.
|
||||
If you're sure that it won't cause problems, if operators of existing deployments don't set the variable, you could also just put:
|
||||
```yaml
|
||||
environment:
|
||||
# ... existing envs
|
||||
- REQUIRE_AUTH_FOR_PROFILE_REQUESTS
|
||||
# ... other exisitng envs
|
||||
```
|
||||
|
||||
2. add env-var to the `.env.sample`
|
||||
```yaml
|
||||
#REQUIRE_AUTH_FOR_PROFILE_REQUESTS=true
|
||||
```
|
||||
|
||||
3. now you can use the environment-variable in your `.tmpl` files, e.g. add to `homserver.yaml.tmpl`
|
||||
```yaml
|
||||
require_auth_for_profile_requests: {{ env "REQUIRE_AUTH_FOR_PROFILE_REQUESTS" }}
|
||||
```
|
||||
|
||||
4. increase number of YAML-version in `abra.sh` (e.g. from `v30` to `v31`), only then it will be deployed.
|
||||
```yaml
|
||||
export HOMESERVER_YAML_VERSION=v31
|
||||
```
|
||||
|
||||
Note: If during development and testing you have to increase it several times, you can just "flatten" it in the end. Only make sure that you `undeploy`/`deploy` your existing instance.
|
||||
|
||||
### Global environment variables
|
||||
|
||||
- `TYPE`: specifies the recipe name
|
||||
|
Loading…
x
Reference in New Issue
Block a user