Skip to main content

# A utility tool to create .env files

[![Build Status](https://travis-ci.org/sobolevn/dump-env.svg?branch=master)](https://travis-ci.org/sobolevn/dump-env) [![Coverage](https://coveralls.io/repos/github/sobolevn/dump-env/badge.svg?branch=master)](https://coveralls.io/github/sobolevn/dump-env?branch=master) [![Python Version](https://img.shields.io/pypi/pyversions/dump-env.svg)](https://https://pypi.org/project/dump-env/) [![Docs](https://readthedocs.org/projects/dump-env/badge/?version=latest)](http://dump-env.readthedocs.io/en/latest/?badge=latest)

dump-env takes an .env.template file and some optional environmental variables to create a new .env file from these two sources. No external dependencies are used.

## Why?

Why do we need such a tool? Well, this tool is very helpful when your CI is building docker (or other) images. [Previously](https://github.com/wemake-services/wemake-django-template/blob/6a7ab060e8435fd855cd806706c5d1b5a9e76d12/%7B%7Bcookiecutter.project_name%7D%7D/.gitlab-ci.yml#L25) we had some complex logic of encrypting and decrypting files, importing secret keys and so on. Now we can just create secret variables for our CI, add some prefix to it, and use dump-env to make our life easier.

## Quickstart

This quick demo will demonstrate the main and the only purpose of dump-env:

`bash $ dump-env --template=.env.template --prefix='SECRET_ENV_' > .env `

This command will:

  1. take .env.template

  2. parse its keys and values

  3. read and all the variables from the environment starting with SECRET_ENV_

  4. remove this prefix

  5. mix it all together, where environment variables could override ones with the same name from the template

  6. sort keys in alphabetic order

  7. dump all the keys and values into the .env file

## Installation

`bash $ pip install dump-env `

## Creating secret variables in some CIs

Release files for dump-env 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dump-env 0.2.0
File Size Uploaded
dump-env-0.2.0.tar.gz 4.8 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for dump-env 0.2.0
File Interpreter ABI Platform
dump_env-0.2.0-py3-none-any.whl Python 3 none any Details
dump_env-0.2.0-py2-none-any.whl Python 2 none any Details

Total release size: 12.9 kB

Release files / dump-env-0.2.0.tar.gz

Download URL dump-env-0.2.0.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
0c6dd783d453ed3444abd21f818a1289b5638f223127277c70d5b9e7f6509140
BLAKE2b-256 checksum
How to use checksums
ea271c09fe02dce4c87cbf7a300963fdbbbeb8a866c9b5649fc9a363530d888d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / dump_env-0.2.0-py3-none-any.whl

Download URL dump_env-0.2.0-py3-none-any.whl
Size 4.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dc4e3d689d61c84cbeb064d941c68a8b171ab2b574da2ee16a42f1382024705d
BLAKE2b-256 checksum
How to use checksums
22bf23b8f2c7a6550b4c6c8ab6d5393f4151732345e637c3166ae970f6b68a40
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / dump_env-0.2.0-py2-none-any.whl

Download URL dump_env-0.2.0-py2-none-any.whl
Size 4.0 kB
Tags Python 2
SHA-256 checksum
How to use checksums
df3cc34d29ef8945144b80e07b5d7d288848a693574fa1b78a47f877bf8563b1
BLAKE2b-256 checksum
How to use checksums
fbeb4d2e206ce8aff8b6dabf489811f0bd6cfbb4f4c4ce6e0d913bb2c4182cba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

1.8.0

2 release files

1.7.0

2 release files

1.6.0

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.2.1

2 release files

This release

0.2.0 This release

3 release files

0.1.1

3 release files

0.1.0

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page