Skip to main content

encrypto-env Build Status

With one command, you can setup and encrypt your environment variables.

💊 Install

pip3 install encryptoenv

What is it?

Encrypto-env is a cli tool that makes it easy to setup, encrypt, and access environment variables for your personal projects. To encrypt the .env file, an RSA key is used (stored in a pem file). The user can then access the environment variables by specifying the location of the .env file and RSA key in their own program.

By default, when the encrpytoenv command is run, the following files will be created:

  • cwd/
    • env/
      • my_key.pem
      • .env
  1. creates env directory in the current working directory
  2. creates my_key.pem, the RSA key, in the env directory
  3. creates .env, the file holding the variables, in the env directory

🍔 How to Use the CLI Tool

Basic Use Case

$ encryptoenv -a "USERNAME=jgrugru" "PASSWORD=Password1234" -E

This command:

  1. creates an ./env dir in the current directory.
  2. creates ./env/.env file in the current directory.
  3. creates ./env/my_key.pem
  4. -a option adds variables in the .env file
  5. -E option encrypts the .env file with the specified key, in this case, the default "my_key.pem"

Accessing the Variables

Once encrypted, your variables can be accessed within your own program after adding one line of code.

from encryptoenv.EnvFile import EnvFile

EnvFile().create_environment_variables()

print(environ["USERNAME"])

If all the files are in the default location and the env/ file is in your current working directory, you can add the line of code above without any chances. If your files are not in the default location, you can specify each path or specify only the environment path if the filenames are the same.

EnvFile(environment_path='.\ENV\').create_environment_variables()

If you need to set the .env filename or pem filename, you can do so through key word arguments:

EnvFile(environment_path='.\ENV\', filename='env.txt', pem_filename='RSA_KEY.pem').create_environment_variables()

Argument Options

$ python encryptoenv/main.py -h
usage: encrypto-env [options] path

Encrypt the contents of your .env file with an RSA key.

optional arguments:
  -h, --help            show this help message and exit
  -p pem_filepath, --pem-file pem_filepath
                        The pem filepath relative to the environment path folder
  --environment-path env_path
                        Default is 'env' dir. Default dir for RSA key and .env
  -a var [var ...], --add-variable var [var ...]
                        Add variables to the .env file
  --clear               Clear the contents of the .env file
  --dot-env-file dot_env_file
                        The .env filepath relative to the environment path folder
  -v, --verbose         Verbose ouptut
  --version             show program's version number and exit
  -E, --Encrypt         Encrypt .env file
  -D, --Decrypt         Decrypt .env file
  --no-key              Disables creation of my_key.pem file
  -l, --list-variables  List the variable names stored in the .env file

📌 Using Arguments from a txt file

If your pem and .env file are not in the default locations, you may find yourself typing out the filepaths for each command repeatedly. To avoid this, your parameters can be stored in a txt file.

You can create a txt file that looks something like this:

--environment-path
/home/jgrugru/Desktop/projects/encrypto-env/my_environment/
-p
RSA_KEY.pem
--dot-env-file
ENV

You can add these parameters from the text file by using the @ symbol:

$ python encryptoenv/main.py @my_parameters.txt

You can also add additional arguments:

$ python encryptoenv/main.py @my_parameters.txt -a "USERNAME=jgrugru" -E

Metadata

Release files for encryptoenv 0.0.2

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

Source distribution (sdist)

Source distribution for encryptoenv 0.0.2
File Size Uploaded Provenance
encryptoenv-0.0.2.tar.gz 6.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for encryptoenv 0.0.2
File Interpreter ABI Platform
encryptoenv-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 13.2 kB

Release files / encryptoenv-0.0.2.tar.gz

Download URL encryptoenv-0.0.2.tar.gz
Size 6.3 kB
Tags Source
SHA-256 checksum
How to use checksums
3bf56ab3d0bbc185cf38d6b5bb3069d037cfcfb900c3ac71061e378672763d0f
BLAKE2b-256 checksum
How to use checksums
1e840328801bf19e4a7bfbde293ecfb9eafd5e08cbe36a8d2bf2203991825142
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

Release files / encryptoenv-0.0.2-py3-none-any.whl

Download URL encryptoenv-0.0.2-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1da9dbb4ae770e925a7774fc014d9d7b324052f316e2a22418eca1455268ae14
BLAKE2b-256 checksum
How to use checksums
42e862a908d3ff4d6251ea53929ee01d90df234b02f7853eae2ec410addf40f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

Security for encryptoenv 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files No provenance

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