environment variables without CONFIGGLUE_ string
Hi,
I'm not sure if this project is still being maintained, but it seems to be the
only Python library available which facilitates passing options to a program
using a combination of config files, environment variables and command line
options in structured and consistent way. For that, I congratulate the authors
on a job well done.
But I have a question / feature request ?
I notice that it is possible to override options using environment variables
using the uppercase of the long option name, but only if the environment
variable name is preceded by the string "CONFIGGLUE_".
For example, if my program takes an option called "--password" the user can
specify this by setting the environment variable "CONFIGGLUE_
Would it be possible to allow the use of variables without the
prefix "CONFIGGLUE_" or at least make the feature configurable? The behaviour
is hard-coded in configglue/glue,py as follows:
env_value = os.environ.
long_
The user should need to know nothing of the specific libraries being used by an
application, so it is un-intuitive for them to use the string "CONFIGGLUE_".
I would like the user to be able specify the environment variable name
exactly as shown in the help message (i.e. the "meta" variable name).
Here is an example:
#!/usr/bin/env python
from configglue import (schema, app)
class MySchema(
password = schema.
app = app.App(MySchema)
import pprint
pprint.
With the above code the help looks like this...
$ ./app.py -h
Usage: app.py [options]
Options:
-h, --help show this help message and exit
--validate validate configuration
--password=
$
Yet, to specify the "password" option using an environment variable,
the user has to use the variable "CONFIGGLUE_
$ CONFIGGLUE_
{'password': 'p'}
$
$ PASSWORD=p ./app.py
{'password': ''} # i.e. PASSWORD not used
$
As a local fix, simply hacking out the string "CONFIGGLUE_" from glue.py
seems to do the trick, but I'm seeking a long term solution.
$ PASSWORD=p ./app.py
{'password': 'p'} # success !
$
Question information
- Language:
- English Edit question
- Status:
- Expired
- For:
- configglue Edit question
- Assignee:
- No assignee Edit question
- Last query:
- Last reply: