-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update readme and change a few class names.
- Loading branch information
1 parent
467a686
commit 305f2a8
Showing
3 changed files
with
82 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,26 @@ | ||
# Local Environment Variables | ||
|
||
This package allows you to specify which environmental variable you require in you application. It will create a `.env` file, prompt you to populate and add the `.env` file to your `.gitignore` file. | ||
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](https://12factor.net/) section [III Config](https://12factor.net/config). | ||
|
||
## Implementation | ||
|
||
```python | ||
from local_env_vars.env import LocalEnvVars | ||
|
||
env = EnvironmentManager("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 a `.env` file with 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. | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters