Skip to content
This repository has been archived by the owner on Mar 29, 2024. It is now read-only.

Exportable Environment Variables #117

Closed
bramwelt opened this issue Jul 25, 2014 · 6 comments
Closed

Exportable Environment Variables #117

bramwelt opened this issue Jul 25, 2014 · 6 comments

Comments

@bramwelt
Copy link
Contributor

In order to use configman in Socorro, the env command is required because the configuration keys contain periods. This prevents us from exporting environment variables in the shell.

One way this could work is if configuration options were guaranteed to be unique and shell counterparts did not contain invalid characters such as . or -. Each config option could have periods replaced by underscores, and underscores in the name replaced by double-underscores.

@twobraids
Copy link
Contributor

Opportune timing, #116 has addressed this issue, but while it is in the latest master branch of configman, we need to do an official point release of configman before socorro can use it.

To avoid this issue of having collisions with existing config options that use the underscore (postgres connection parameters), I decided to use the double underscore for shell variable as the stand in for the .

export source__database_host=192.168.1.11

will be interpreted by configman as source.database_host

the - case is not covered by that PR. I think the only offender is crontabber. I suggest that be addressed in the crontabber code. The - character in the crontabber config causes some problems in Python code as well as the shell. The configman option names really should comply with Python identifier rules:

    config.jobs.class-AutomaticEmailsCronApp.email_template    # invalid
    config.jobs.class_AutomaticEmailsCronApp.email_template    # better

@peterbe
Copy link
Contributor

peterbe commented Jul 28, 2014

That looks like it would be easy to fix code-wise but it's kinda scary to change because it would break things for those who have already made .ini files. No?

@peterbe
Copy link
Contributor

peterbe commented Jul 28, 2014

hehe! I just noticed slide #80. Timely.

@twobraids
Copy link
Contributor

@peterbe, yes the crontabber change would break backward compatibility. I really regret that -. have any ideas how we could do it and preserve compatibility? triple underscore?

@bramwelt
Copy link
Contributor Author

Could it not just convert - to underscores first?

@twobraids
Copy link
Contributor

this issue was addressed long ago. re-open if anyone disagrees.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants