Skip to content

Commit

Permalink
Read from env variables
Browse files Browse the repository at this point in the history
Signed-off-by: Sylvain Hellegouarch <sh@defuze.org>
  • Loading branch information
Lawouach committed Jul 11, 2023
1 parent 6a78a97 commit f6518a3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@

## [Unreleased][]

[Unreleased]: https://github.com/chaostoolkit-incubator/chaostoolkit-azure/compare/0.15.1...HEAD
[Unreleased]: https://github.com/chaostoolkit-incubator/chaostoolkit-azure/compare/0.15.2...HEAD

## [0.15.2][] - 2023-07-11

[0.15.2]: https://github.com/chaostoolkit-incubator/chaostoolkit-azure/compare/0.15.1...0.15.2

### Added

* Load secrets from env variables as well

## [0.15.1][] - 2023-07-11

Expand Down
15 changes: 10 additions & 5 deletions chaosazure/common/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,17 @@ def load_secrets(experiment_secrets: Secrets):
# 1: lookup for secrets in experiment file
if experiment_secrets:
return {
'client_id': experiment_secrets.get('client_id'),
'client_secret': experiment_secrets.get('client_secret'),
'tenant_id': experiment_secrets.get('tenant_id'),
'client_id': experiment_secrets.get(
'client_id', os.getenv("AZURE_CLIENT_ID")),
'client_secret': experiment_secrets.get(
'client_secret', os.getenv("AZURE_CLIENT_SECRET")),
'tenant_id': experiment_secrets.get(
'tenant_id', os.getenv("AZURE_TENANT_ID")),
# load cloud object
'cloud': cloud.get_or_raise(experiment_secrets.get('azure_cloud')),
'access_token': experiment_secrets.get('access_token'),
'cloud': cloud.get_or_raise(
experiment_secrets.get('azure_cloud', os.getenv("AZURE_CLOUD"))),
'access_token': experiment_secrets.get(
'access_token', os.getenv("AZURE_ACCESS_TOKEN")),
}

# 2: lookup for credentials in azure auth file
Expand Down

0 comments on commit f6518a3

Please sign in to comment.