Python environment variable wrapper around Consul key/value storage. When instantiated, EnvConsol
fetches the key value data for a defined service from Consul. These environment variables are retrievable via the path they were stored in Consul.
For example if we insert a database name for specific services in Consul
shell
curl -X PUT -d 'db.sqlite3' \
http://localhost:8500/v1/kv/web00.django.test/databases/default/name
EnvConsul can fetch and be queried like so
python
import envconsul
ENV_CONSUL = envconsul.EnvConsul('web00.django.test')
DATABASE_NAME = ENV_CONSUL.get_str('/databases/default/name')
consulate
shell
pip install envconsul
```python import envconsul
ENV_CONSUL = envconsul.EnvConsul('web00.django.test')
ENV_CONSUL = envconsul.EnvConsul( service_name='web00.django.test', host="localhost", port=8500, ) ```
Full example here Django settings file here
shell
curl -X PUT -d 'True' http://localhost:8500/v1/kv/web00.django.test/debug
python
DEBUG = ENV_CONSUL.get_bool('/debug', True)
shell
curl -X PUT -d "example.com, example.com." http://localhost:8500/v1/kv/web00.django.test/allowed_hosts
python
ALLOWED_HOSTS = []
ALLOWED_HOSTS += ENV_CONSUL.get_list('/allowed_hosts', [])
shell
curl -X PUT -d 'django.contrib.admin, env' http://localhost:8500/v1/kv/web00.django.test/installed_apps
python
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
)
INSTALLED_APPS += ENV_CONSUL.get_tuple('/installed_apps', ['django.contrib.admin',])
shell
curl -X PUT -d 'django.db.backends.sqlite3' http://localhost:8500/v1/kv/web00.django.test/databases/default/engine
curl -X PUT -d 'db.sqlite3' http://localhost:8500/v1/kv/web00.django.test/databases/default/name
python
DATABASES = {
'default': {
'ENGINE': ENV_CONSUL.get_str('/databases/default/engine'),
'NAME': os.path.join(BASE_DIR, ENV_CONSUL.get_str('/databases/default/name', 'db.sqlite3')),
}
}
python
REDIS_HOST = ENV_CONSUL.get('/redis_host')
Full example here Django settings file here
Git clone project
git clone https://github.com/cevaris/python-envconsul.git
Build and install project
pip install -r requirements-dev.txt
Run tests
py.test tests/
Bumps wheel from 0.24.0 to 0.38.1.
Sourced from wheel's changelog.
Release Notes
UNRELEASED
- Updated vendored
packaging
to 22.00.38.4 (2022-11-09)
- Fixed
PKG-INFO
conversion inbdist_wheel
mangling UTF-8 header values inMETADATA
(PR by Anderson Bravalheri)0.38.3 (2022-11-08)
- Fixed install failure when used with
--no-binary
, reported on Ubuntu 20.04, by removingsetup_requires
fromsetup.cfg
0.38.2 (2022-11-05)
- Fixed regression introduced in v0.38.1 which broke parsing of wheel file names with multiple platform tags
0.38.1 (2022-11-04)
- Removed install dependency on setuptools
- The future-proof fix in 0.36.0 for converting PyPy's SOABI into a abi tag was faulty. Fixed so that future changes in the SOABI will not change the tag.
0.38.0 (2022-10-21)
- Dropped support for Python < 3.7
- Updated vendored
packaging
to 21.3- Replaced all uses of
distutils
withsetuptools
- The handling of
license_files
(including glob patterns and default values) is now delegated tosetuptools>=57.0.0
(#466). The package dependencies were updated to reflect this change.- Fixed potential DoS attack via the
WHEEL_INFO_RE
regular expression- Fixed
ValueError: ZIP does not support timestamps before 1980
when usingSOURCE_DATE_EPOCH=0
or when on-disk timestamps are earlier than 1980-01-01. Such timestamps are now changed to the minimum value before packaging.0.37.1 (2021-12-22)
- Fixed
wheel pack
duplicating theWHEEL
contents when the build number has changed (#415)- Fixed parsing of file names containing commas in
RECORD
(PR by Hood Chatham)0.37.0 (2021-08-09)
- Added official Python 3.10 support
- Updated vendored
packaging
library to v20.9
... (truncated)
6f1608d
Created a new releasecf8f5ef
Moved news item from PR #484 to its proper place9ec2016
Removed install dependency on setuptools (#483)747e1f6
Fixed PyPy SOABI parsing (#484)7627548
[pre-commit.ci] pre-commit autoupdate (#480)7b9e8e1
Test on Python 3.11 finala04dfef
Updated the pypi-publish action94bb62c
Fixed docs not building due to code style changesd635664
Updated the codecov action to the latest versionfcb94cd
Updated version to match the releaseDependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase
.
Bumps ipython from 3.0.0 to 7.16.3.
d43c7c7
release 7.16.35fa1e40
Merge pull request from GHSA-pq7m-3gw7-gq5x8df8971
back to dev9f477b7
release 7.16.2138f266
bring back release helper from master branch5aa3634
Merge pull request #13341 from meeseeksmachine/auto-backport-of-pr-13335-on-7...bcae8e0
Backport PR #13335: What's new 7.16.28fcdcd3
Pin Jedi to <0.17.2.2486838
release 7.16.120bdc6f
fix conda buildDependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase
.
Bumps django from 1.7.2 to 2.2.24.
2da029d
[2.2.x] Bumped version for 2.2.24 release.f27c38a
[2.2.x] Fixed CVE-2021-33571 -- Prevented leading zeros in IPv4 addresses.053cc95
[2.2.x] Fixed CVE-2021-33203 -- Fixed potential path-traversal via admindocs'...6229d87
[2.2.x] Confirmed release date for Django 2.2.24.f163ad5
[2.2.x] Added stub release notes and date for Django 2.2.24.bed1755
[2.2.x] Changed IRC references to Libera.Chat.63f0d7a
[2.2.x] Refs #32718 -- Fixed file_storage.test_generate_filename and model_fi...5fe4970
[2.2.x] Post-release version bump.61f814f
[2.2.x] Bumped version for 2.2.23 release.b8ecb06
[2.2.x] Fixed #32718 -- Relaxed file name validation in FileField.Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase
.