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
# 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.2.tar.gz
(3.1 kB
view details)
Built Distribution
File details
Details for the file secrets2env-0.1.2.tar.gz
.
File metadata
- Download URL: secrets2env-0.1.2.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 042a6901ec9306c8ced3f41841933da2f04a93e31067892b5ee0f0e6342b08d8 |
|
MD5 | 158f678e82f55de7dbb9cee05c27b490 |
|
BLAKE2b-256 | 25b171b1fccc1b3ad2578609bd55c0b0997832338a63502f2546ed306c79ab91 |
File details
Details for the file secrets2env-0.1.2-py2.py3-none-any.whl
.
File metadata
- Download URL: secrets2env-0.1.2-py2.py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a13186000dd66107bd3c4a2c83a0e3826416b1eddaa79ba9595cf83a314ccc98 |
|
MD5 | 4b846a726a7b9663d228f172a324f2ec |
|
BLAKE2b-256 | 80ed6b8bbde55179084927571819045347172612ef3b01865efcfd0fcb4d6ff9 |