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

requesting a list via config.get has issues with environment variables #9

Closed
wryfi opened this issue Mar 15, 2022 · 0 comments
Closed

Comments

@wryfi
Copy link
Owner

wryfi commented Mar 15, 2022

There is currently no bug-free way to specify a single-element list as an environment variable.

Setting the environment variable to a string, and explicitly asking the config manager for a list, produces this:

> export TEST__FOO__ALIST=abc
> export TEST__FOO__BLIST=abc,def
> ipython
...
In [1]: from cfitall.config import ConfigManager

In [2]: config = ConfigManager("test")

In [3]: config.get("foo.alist", list)
Out[3]: ['a', 'b', 'c']

In [4]: config.get("foo.blist", list)
Out[4]: ['abc', 'def']

Appending a comma to the environment variable returns a two-item list, with an empty second item:

> export TEST__FOO__ALIST=abc,
> ipython
...
In [1]: from cfitall.config import ConfigManager

In [2]: config = ConfigManager("test")

In [3]: config.get("foo.alist", list)
Out[3]: ['abc', '']

Please devise a better syntax that accommodates single-element lists as environment variables.

@wryfi wryfi closed this as completed in fde79f3 Apr 11, 2022
wryfi added a commit that referenced this issue Apr 11, 2022
* Bump bleach from 3.2.1 to 3.3.0

Bumps [bleach](https://github.com/mozilla/bleach) from 3.2.1 to 3.3.0.
- [Release notes](https://github.com/mozilla/bleach/releases)
- [Changelog](https://github.com/mozilla/bleach/blob/master/CHANGES)
- [Commits](mozilla/bleach@v3.2.1...v3.3.0)

Signed-off-by: dependabot[bot] <[email protected]>

* update deprecated import and reformat w/ black

* reformatted all code w/ black

* update Pipfile.lock

* v2.0 release candidate (fixes #9, fixes #9) (#10)

* changelog

* add test for bug

* use brackets for lists in env vars

* update README and tests

* README

* modularize environment variable management

* new modular architecture

* type utils

* pluggable providers

* fix circular imports when running unit tests from root directory

* documentation

* docs

Co-authored-by: Chris Haumesser <[email protected]>

* update README

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Chris Haumesser <[email protected]>
wryfi added a commit that referenced this issue Apr 12, 2022
* Bump bleach from 3.2.1 to 3.3.0

Bumps [bleach](https://github.com/mozilla/bleach) from 3.2.1 to 3.3.0.
- [Release notes](https://github.com/mozilla/bleach/releases)
- [Changelog](https://github.com/mozilla/bleach/blob/master/CHANGES)
- [Commits](mozilla/bleach@v3.2.1...v3.3.0)

Signed-off-by: dependabot[bot] <[email protected]>

* update deprecated import and reformat w/ black

* reformatted all code w/ black

* update Pipfile.lock

* v2.0 release candidate (fixes #9, fixes #9) (#10)

* changelog

* add test for bug

* use brackets for lists in env vars

* update README and tests

* README

* modularize environment variable management

* new modular architecture

* type utils

* pluggable providers

* fix circular imports when running unit tests from root directory

* documentation

* docs

Co-authored-by: Chris Haumesser <[email protected]>

* update README

* remove old python versions

* rtd updates

* typo

* rtd

* rtd

* rtd

* fix issues w/ python 3.8 typing

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Chris Haumesser <[email protected]>
wryfi added a commit that referenced this issue Feb 2, 2024
* Bump bleach from 3.2.1 to 3.3.0

Bumps [bleach](https://github.com/mozilla/bleach) from 3.2.1 to 3.3.0.
- [Release notes](https://github.com/mozilla/bleach/releases)
- [Changelog](https://github.com/mozilla/bleach/blob/master/CHANGES)
- [Commits](mozilla/bleach@v3.2.1...v3.3.0)

Signed-off-by: dependabot[bot] <[email protected]>

* update deprecated import and reformat w/ black

* reformatted all code w/ black

* update Pipfile.lock

* v2.0 release candidate (fixes #9, fixes #9) (#10)

* changelog

* add test for bug

* use brackets for lists in env vars

* update README and tests

* README

* modularize environment variable management

* new modular architecture

* type utils

* pluggable providers

* fix circular imports when running unit tests from root directory

* documentation

* docs

Co-authored-by: Chris Haumesser <[email protected]>

* update README

* remove old python versions

* rtd updates

* typo

* rtd

* rtd

* rtd

* fix issues w/ python 3.8 typing

* add github workflow

* update for newer versions of python and pyyaml

* add tomli for python<3.11

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Chris Haumesser <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant