A simple local environmental variable manager
Project description
Local Environment Variables
This package allows you to specify which environmental variable you require in your application. It will create a .env
file, prompt you to populate it, and add the .env
file to your .gitignore
file.
The functionality described is in line with the guidelines set out in the The Twelve-Factor App section III Config.
Implementation
from local_env_vars.env import LocalEnvVars
env = LocalEnvVars("sql_server_address", "sql_username", "sql_password")
connection_string = "Driver={{SQL Server}};Server={0}; Database=AdventureWorks;uid={1};pwd={2}".format(
env.vars['sql_server_address'], env.vars['sql_username'], env.vars['sql_password']
)
Running this code for the first time will create an .env
and add .evn
to the project .gitignore
file.
The .env
file will have the following content. It will throw an exception reporting that you must provide values to the keys.
{"sql_server_address": "", "sql_username": "", "sql_password": ""}
After you have populated the keys with values you will be able to execute the code without any exceptions.
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
Built Distribution
File details
Details for the file local-env-vars-0.0.4.tar.gz
.
File metadata
- Download URL: local-env-vars-0.0.4.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.25.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 522500aae0d7a5016cee403eef079c33b7f25dcd13e89effeae1a259dff07845 |
|
MD5 | f5fd9e81d6c7e5de0a58ea4d7cf89ab3 |
|
BLAKE2b-256 | f035616eca6d758639c0b395cfc1937ab1f8a79afcb1116cb99ac2c52d7bc3e6 |
File details
Details for the file local_env_vars-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: local_env_vars-0.0.4-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.25.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 966352f9d6d5ef2d3eec3acc5be7e5c4b0a0eb0ab8703ef122b54af298ce7fe9 |
|
MD5 | 51ca922679254a1a568753b2a0d13207 |
|
BLAKE2b-256 | 3b3428be23bde49641272e0ccfcfcfe906cb5b58df2a163caa0770dfe7a32107 |