Command-line tool for generating environment variables from AWS Secrets
Project description
secret2env
Command-line tool for generating sourcable environment variables from secrets in AWS Secrets Manager using a YAML definition.
Installation
$ pip install secrets2env
Environment Definition
Below is an example environment definition. The values for environment variables will be generated
using .format()
and keyword arguments.
- secret: aws/secret-name
name: ENV_SECRET
value: "{key1-in-secret}"
- secret: production/postgresql
name: PSQL_URI
value: "postgresql://{username}:{password}@postgresql:5432/{dbname}"
Usage
Path to a definition like the one can be provided as argument, otherwise it defaults to ./aws-secrets.yml
.
Running secrets2env
will print a sourceable environment to STDOUT which can be eval
d or redirected to an environment file.
# with path to definition file
$ secrets2env --definition path/to/definition.yml
# or using the default path (./aws-secrets.yml) with the definition above
$ secrets2env
It will result in the following output
# Autogenerated by <path/to/installed/secrets2env.py>
export ENV_SECRET='some-secret'
export PSQL_URI='postgresql://pg-user:pg-pw@postgresql:5432/pgdb'
# you can eval directly
eval "`secrets2env`"
# or redirect to file
echo -e "\n`secrets2env`" >> env.sh
Limitations / TODOs
- currently only supports
SecretString
- currently only supports OsX and Linux
- no automated tests
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
secrets2env-0.1.4.tar.gz
(3.3 kB
view hashes)
Built Distribution
Close
Hashes for secrets2env-0.1.4-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 94520855b6d097c102865e8d202077536281acddd8c5bec47d78c16cf0b04dae |
|
MD5 | e63ca0c57260ecb158264d2646e27245 |
|
BLAKE2b-256 | 0d7193e2d0f0b802a986cff6a67f9e8d10d6d843a1a85d357c7bc2215476b71e |