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

Use ENV variables #8

Closed
benwyrosdick opened this issue Mar 24, 2015 · 6 comments
Closed

Use ENV variables #8

benwyrosdick opened this issue Mar 24, 2015 · 6 comments

Comments

@benwyrosdick
Copy link
Contributor

The app is hard to deploy and host because you have to deal with a JSON config file that you don't want checked in but needs to be on the server. It would make sense for the config object to try to read from ENV and fall back to defaults. This would make it easier to deal with and deploy.

@matejkramny
Copy link
Contributor

Fair point, and shouldn't be too hard..
It will probably be done at the same time as the UI upgrade (feature/ui-work branch).

@benwyrosdick
Copy link
Contributor Author

👍

@bibby
Copy link

bibby commented Mar 31, 2015

IMO, this is only partly done. The default values for the environment variables only come into play in the presence of the config json file you are trying to remove. Default env vars should be present in the Dockerfile as an indicator for users who wish to override them.

For example

ENV REDIS_HOST 127.0.0.1
ENV REDIS_PORT 6379

@matejkramny
Copy link
Contributor

@bibby Check out https://github.com/ansible-semaphore/semaphore/blob/master/lib/config.js#L7

The program is runnable w/o configuration files.

@bibby
Copy link

bibby commented Apr 1, 2015

The line you have linked tests for the absence of environment variables. The defaults are then loaded from the configuration file. So in that way, no, it cannot run w/o config files.

Using ENV in the dockerfile with a default value means the required value is never absent, being either a user defined value or the predefined default.

@matejkramny
Copy link
Contributor

  1. Tries to load configuration file
  2. If not present, tests for some required env variables. If they're not present, the program cannot run
  3. Load default configuration
  4. (line 17-21) Overrides configuration from environment

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

No branches or pull requests

3 participants