Skip to main content
A helping hand to manage your settings among different environments

## Intro

Managing application configuration that runs on multiple environments
can be tough. So, **envelop** comes to help you pretend you have only one
settings file that magically works whenever you deploy.

Here at Yipit, we use Chef to coordinate the deploy process and to maintain the
configuration, using attributes or data bags.

After that, we use [envdir](http://cr.yp.to/daemontools/envdir.html)
to run our applications with variables set in Chef. Then, we use
**envelop** to read those variables and feed the application configuration
system.

## Production

The system environment is the first place **envelop** will try to find
things. So, when the application runs inside of an environment with the right
variables set, it will just work.

So, if you know you have environment variables
`DATABASE_URI` and `ALLOWED_IPS` like this:

```bash
$ export DATABASE_URI=mysql://root@localhost:3306/mydb
$ export ALLOWED_IPS=10.0.0.1,10.0.0.2
```

The application settings glue code will look like this:

```python
>>> from envelop import Environment
>>> env = Environment()
>>> dburi = env.get_uri('DATABASE_URI')
>>> dburi.host
u'localhost'
>>> dburi.port
3306
>>> env.get_list('ALLOWED_IPS')
['10.0.0.1', '10.0.0.2']
```

## Local

If you just want to load things from a file locally, the
`Environment.from_file()` constructor will help you out.

```python
>>> from envelop import Environment
>>> env = Environment.from_file('/etc/app.cfg')
>>> env.get_bool('BOOL_FLAG')
True
>>> env.get_float('FLOAT_VAL')
3.14
```

The file `app.cfg` will look like this:

```yaml
BOOL_FLAG: True

FLOAT_VAL: 3.14
```

## From a folder

You can also load variables from a folder, where each file will be an
environment variable and the file's content will be the value. Just like
[envdir](http://cr.yp.to/daemontools/envdir.html).

Now, say that you have the folder `/etc/envdir/app` and this folder contains
the file `MYSQL_CONN_URI` with a database URL inside of it. Just like this one
here: `mysql://root:secret@localhost:3306/mydb`.

To read that directory and load the variable properly, you just have to do the
following:

```python
>>> from envelop import Environment
>>> env = Environment.from_folder('/etc/envdir/app')
>>> uri = env.get_uri('MYSQL_CONN_URI')
>>> uri.host
'localhost'
>>> uri.port
3306
>>> uri.user
'root'
>>> uri.password
'secret'
```

# Hacking on it

## Install dev dependencies

```console
pip install -r requirements-dev.txt
```

## Run tests

```console
make test
```

## Change it

Make sure you write tests for your new features and keep the test coverage in 100%

## Release it

After you already made your commits, run:

```console
make release
```

follow the instructions and do the [harlem shake](http://www.youtube.com/watch?v=8vJiSSAMNWw)


## Project history

This project was started by [Lincoln de Sousa](https://github.com/clarete) and was called ["Milieu"](https://github.com/clarete/milieu). We renamed it to "Envelop" on May 21st, 2014.

Metadata

Release files for envelop 0.3.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 envelop 0.3.0
File Size Uploaded Provenance
envelop-0.3.0.tar.gz 9.1 kB Without provenance Details

Release files / envelop-0.3.0.tar.gz

Download URL envelop-0.3.0.tar.gz
Size 9.1 kB
Tags Source
SHA-256 checksum
How to use checksums
23cb77e497ab5cd9050a02d79986be1863856e21d96285da60a223727f6b4978
BLAKE2b-256 checksum
How to use checksums
c8c4f131ad80f30154930747b7126da48d51de3c45a46a0e9b5aeb21319dab29
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for envelop 0.3.0

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.

Release history Release notifications | RSS feed

This release

0.3.0 This release

1 release file 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