Skip to main content

Command-line tool for generating environment variables from AWS Secrets

Project description

Build Status

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 evald 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.3.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

secrets2env-0.1.3-py2.py3-none-any.whl (3.6 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file secrets2env-0.1.3.tar.gz.

File metadata

  • Download URL: secrets2env-0.1.3.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for secrets2env-0.1.3.tar.gz
Algorithm Hash digest
SHA256 802473436320cdca93f62d95b1240f47a07b329046a10802ee2c73e5451ee7fe
MD5 351937101533f65f230dbfcb0617cf3c
BLAKE2b-256 d6b5d572b4f948867cad7cd1cad5648445daf8f17d189092cccf7cbfad9cbe27

See more details on using hashes here.

File details

Details for the file secrets2env-0.1.3-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for secrets2env-0.1.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 a493cb67b01f948432d12d703d629c9041805ec91602cd02d650dbcfaf20a21a
MD5 4a636f8f8b6a26ef377221e41bebe8b8
BLAKE2b-256 96a10417626e40faf3f86fba2cbe741e9da7166a6a7776dbb1b267411333561f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page