Skip to main content

Command-line tool for generating environment variables from AWS Secrets

Project description

[![Build Status](https://travis-ci.org/eguven/secrets2env.svg?branch=master)](https://travis-ci.org/eguven/secrets2env)

# secret2env

Command-line tool for generating sourcable environment variables from secrets in AWS Secrets Manager
using a YAML definition.

## Installation

```shell
$ pip install secrets2env
```

## Environment Definition

Below is an example environment definition. The values for environment variables will be generated
using `.format()` and keyword arguments.

```yaml
- 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

A definition like the one above is expected in `./aws-secrets.yml`. Running `secrets2env` will
print a sourceable environment to STDOUT which can be `eval`d or redirected to an environment file.

```shell
# using the aws-secrets.yml definition above
$ secrets2env
# Autogenerated by <path/to/installed/secrets2env.py>
export ENV_SECRET='some-secret'
export PSQL_URI='postgresql://pg-user:pg-pw@postgresql:5432/pgdb'
```

```shell
# 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.1.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

secrets2env-0.1.1-py2.py3-none-any.whl (5.1 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

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

File hashes

Hashes for secrets2env-0.1.1.tar.gz
Algorithm Hash digest
SHA256 66599157a2e1588d5ebe6a198f4312a50ee97f2b4fc24cc0a962e07ab101a57d
MD5 4145e9b45eb4b224374a846dc26b1eab
BLAKE2b-256 69f4b4573e2494b5496adf1c7c1461380d9d805dfde5a212afefefe58a2794df

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for secrets2env-0.1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 c12637e0313fd77e2112f0ab109d27333c719e0754183a036557bd84b85c2771
MD5 da4640f918267b8cda2b4932c16877d0
BLAKE2b-256 e288da3b157baf65a87aad3eaac0c25ec1a1e8da8d530cdaab31430c330f2118

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