Set config values with environment variables #64
Labels
No labels
bug
enhancement
good first issue
halted
help wanted
security
wait for upstream
wait to be tested
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: b3yond/ticketfrei#64
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Author: @b3yond Posted at: 06.11.2018 08:04
Is your feature request related to a problem? Please describe.
The docker container in https://github.com/ticketfrei/docker-ticketfrei/ needs the option to set config values by environment variables. This would diminish the need for one of the shared volumes, and concentrate configuration in one docker-compose file.
It would be nice to keep the config.toml in the architecture though, if someone needs it - but override the values when environment variables are set.
Describe the solution you'd like
config.py should first check if there is a config file. If there is no config file, it should check if environment variables are set. If they are "", the default values from config.toml.example should be used. Else the environment variables should be used for the config values.
They don't need to be updated during runtime.
Describe alternatives you've considered
Additional context
Problem: If you want to set one of the values to "" by using an environment variable, the value would be overriden by the default value. This should not be a problem with our current config settings though.
Author: @b3yond Posted at: 07.11.2018 08:00
This branch can be tested with staging.tfrei.links-tech.org, which currently runs the envs branch. to do: think of test cases.
I already tested if the env vars are set in config.py.
One possible case would be whether twitter works if you supply consumer_key & consumer_secret via .env file.
Where is the web/host variable even used inside the container? not sure.
The contact variable is impossible to test because I think the container can't send mail atm.
Author: @b3yond Posted at: 19.11.2018 23:09
Author: @b3yond Posted at: 11.01.2019 21:50
contact seems to work too, but sending mails doesn't work yet.