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

Set config values with environment variables #64

Open
b3yond opened this issue Nov 6, 2018 · 3 comments
Open

Set config values with environment variables #64

b3yond opened this issue Nov 6, 2018 · 3 comments

Comments

@b3yond
Copy link
Member

b3yond commented Nov 6, 2018

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

  1. The status quo is okay, but requires shared volumes in the docker setup, and a non-intuitive setup process for admins. Copying the config.toml.example -> config.toml and THEN editing it is a bit weird, but necessary due to our git workflows... this could be better.
  2. Using only environment variables is not useful too. For some it may not be easily debugabble to have everything in env variables. If you don't use docker, they are harder to document and everything.

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.

@b3yond
Copy link
Member Author

b3yond commented Nov 7, 2018

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.

@b3yond
Copy link
Member Author

b3yond commented Nov 19, 2018

  • twitter works. <3
  • host definitely works, too, the callback url for the twitter API could be generated correctly, for example.
  • contact needs to be tested. dependent on Add exim4 support docker-ticketfrei#3

@b3yond
Copy link
Member Author

b3yond commented Jan 11, 2019

contact seems to work too, but sending mails doesn't work yet.

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

No branches or pull requests

1 participant