Skip to main content

consul-decouple

PyPI

An extension for python-decouple to read Consul using python-consul2.

pip install consul-decouple

How it works

  1. Read config from environment;

  2. If it’s connected with Consul, it’ll read the config from there;

  3. python-decouple behavior:

    1. Repository: ini or .env file;

    2. default argument passed to config;

How to use

  • Read Consul settings from enviroment. CONSUL_HOST=host, CONSUL_PORT=port, CONSUL_TOKEN=token, CONSUL_SCHEME=scheme

from consul_decouple import config

my_key = config('my_bool_key', cast=bool, default=False)
  • Creating a custom Consul connection

from consul import Consul
from consul_decouple import AutoConfig

consul = Consul(host='127.0.0.1', port=8500, token=None, scheme='http')
config = AutoConfig(consul)
my_key = config('my_bool_key', cast=bool, default=False)
  • Read only one KeyValue from Consul and parse it from JSON. It’ll reads the configs from the parsed JSON

from consul_decouple import AutoConfig

config = AutoConfig(json_kv='my_key_with_json_value')
my_key = config('my_bool_key', cast=bool, default=False)

Contribute

git clone https://github.com/lucasrcezimbra/consul-decouple
cd consul-decouple
python -m venv .venv
source .venv/bin/activate
pip install -r requirements-dev.txt
pre-commit install
docker-compose up -d
pytest

Metadata

Release files for consul-decouple 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 consul-decouple 0.0.2
File Size Uploaded Provenance Actions
consul-decouple-0.0.2.tar.gz 12.7 kB Without provenance Details for consul-decouple-0.0.2.tar.gz

Release files / consul-decouple-0.0.2.tar.gz

Download URL consul-decouple-0.0.2.tar.gz
Size 12.7 kB
Tags Source
SHA-256 checksum
How to use checksums
2a15304908d46ec94456de035f2a5a6525d0ebdeaee58ad595ca184894556c07
BLAKE2b-256 checksum
How to use checksums
307d130ff1f5b4c2c5520c5763a8eb5e6699df8212c72fb817c837958907a62a
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.0

Security for consul-decouple 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

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