geopython/pywps

Configuration flooded with current environment

Closed this issue · 3 comments

Hi! While trying to get a special "metadata" config section, I wanted to make it so that anything field present in that section gets added to the metadata of my process' outputs (this is in finch). However, when getting that section through the configuration object, one can't simply list the options, because the whole os environment is included.

Ex: the following : list(configuration.CONFIG['metadata:main'].keys()) returns the metadata keys but also every variable in my environment.

The culprit is:

CONFIG = configparser.ConfigParser(os.environ)

My question, is this necessary? I am no expert in application configuration, but it seems to me a bit over-the-top? Could pyWPS already know which options can be passed through the environment, and only parse those?

This was introduced with PR #365.

@SvenDowideit @jachym what do you think?

we use it to allow our devs to make template configs with not-previously known env vars, which then get expanded from different container env configurations.

ie - pyWPS has no idea what they are.

but idk - over the next years we're looking to move to replacing our config files with URL endpoints, so deployments can customise the config file that a service like pyWPS uses can be dynamically changed based on incoming request headers.

Understood! My workaround in finch is reasonably working, so I'll close this.