Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: prefix and suffix #2

Open
douglasmiranda opened this issue Apr 16, 2018 · 0 comments
Open

Feature: prefix and suffix #2

douglasmiranda opened this issue Apr 16, 2018 · 0 comments
Labels
enhancement New feature or request

Comments

@douglasmiranda
Copy link
Owner

Maybe it would be useful to implement a prefix and suffix optional feature, like:

Envs:

DJANGO_DEBUG=False
DJANGO_SECRET=abc
>>> from gconfigs import GConfigs
>>> from gconfigs.backends import LocalEnv

>>> envs = GConfigs(backend=LocalEnv, prefix="DJANGO_")
>>> envs.as_bool("DEBUG")
False
>>> envs("SECRET")
"abc"

With context managers:

>>> from gconfigs import GConfigs
>>> from gconfigs.backends import LocalEnv

>>> envs = GConfigs(backend=LocalEnv)
>>> with envs.prefix("DJANGO"):
...    envs("SECRET")
...
"abc"

Well, suffix would do the same, but you know... following the suffix logic.

@douglasmiranda douglasmiranda added the enhancement New feature or request label Apr 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant