A utility tool to create .env files
Project description
A utility tool to create ``.env`` files
---------------------------------------
.. image:: https://travis-ci.org/sobolevn/dump-env.svg?branch=master
:target: https://travis-ci.org/sobolevn/dump-env
.. image:: https://coveralls.io/repos/github/sobolevn/dump-env/badge.svg?branch=master
:target: https://coveralls.io/github/sobolevn/dump-env?branch=master
.. image:: https://badge.fury.io/py/dump-env.svg
:target: http://badge.fury.io/py/dump-env
.. image:: https://img.shields.io/pypi/pyversions/dump-env.svg
:target: https://pypi-hypernode.com/pypi/dump-env
.. image:: https://readthedocs.org/projects/dump-env/badge/?version=latest
:target: 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.
Quickstart
~~~~~~~~~~
This quick demo will demonstrate the main and the only purpose of ``dump-env``:
.. code:: 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
~~~~~~~~~~~~
.. code:: bash
$ pip install dump-env
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.
Creating secret variables in some CIs
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ``travis``: `docs <https://docs.travis-ci.com/user/environment-variables/#Defining-encrypted-variables-in-.travis.yml>`_
- ``gitlab-ci``: `docs <https://docs.gitlab.com/ce/ci/variables/README.html#secret-variables>`_
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dump-env-0.1.0.tar.gz
(4.8 kB
view details)
Built Distributions
File details
Details for the file dump-env-0.1.0.tar.gz
.
File metadata
- Download URL: dump-env-0.1.0.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6408c867cf1a578d96655a5ecaedf106de8ec6edf503dbbb8458764b823668d |
|
MD5 | 9cb0155b3b37b967f158d5244784c707 |
|
BLAKE2b-256 | b41908fb1e6898dce28d8fba01a52cd4c768aec5c20d136e422979258b405556 |
File details
Details for the file dump_env-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: dump_env-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 813905fbf8c9f7e6b4a580135505ae243a9428a28ed462f76d76d64f3477fea9 |
|
MD5 | 70cae1da94d0ba735cda5e0c88a7b49f |
|
BLAKE2b-256 | 5ef2021a1d3a6ad1015761e3ab0c02b452df1a24697c4cff744d987d5868039a |
File details
Details for the file dump_env-0.1.0-py2-none-any.whl
.
File metadata
- Download URL: dump_env-0.1.0-py2-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 74be9d9dbe8412d6636cb83e08a074dfb2b6e7e00fd9186e4e2bb1bc601855be |
|
MD5 | 666df9d956f5ce762e7df08979362198 |
|
BLAKE2b-256 | d0d49e3af9423cebc82a2d14806c591be1f0fa5736ed0236164f227fab1b23fc |