Skip to content

Commit

Permalink
Add docs about using env vars for credentials with omegaconfloader
Browse files Browse the repository at this point in the history
  • Loading branch information
merelcht committed Jan 24, 2023
1 parent a6919ef commit 24a87fd
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions docs/source/kedro_project_setup/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,19 @@ data:
Since both of the file names (`parameters.yml` and `parameters_globals.yml`) match the config pattern for parameters, the `OmegaConfLoader` will load the files and resolve the placeholders correctly.


### Environment variables for credentials
The [`OmegaConfLoader`](/kedro.config.OmegaConfLoader) enables you to load credentials from environment variables. To achieve this you have to use the `omegaconf` [`oc.env` resolver](https://omegaconf.readthedocs.io/en/2.3_branch/custom_resolvers.html#oc-env).
This is an example of how you can access credentials from environment variables in `credentials.yml`:

```yaml
dev_s3:
client_kwargs:
aws_access_key_id: ${oc.env:AWS_ACCESS_KEY_ID}
aws_secret_access_key: ${oc.env:AWS_SECRET_ACCESS_KEY}
```

Note that you can only use the resolver in `credentials.yml` and not in catalog or parameter files. This is because we do not encourage the usage of environment variables for anything other than credentials.

## Parameters

### Load parameters
Expand Down

0 comments on commit 24a87fd

Please sign in to comment.