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 CLI flags for configuration instead of environment variables #113

Open
sisp opened this issue Oct 22, 2020 · 4 comments
Open

Use CLI flags for configuration instead of environment variables #113

sisp opened this issue Oct 22, 2020 · 4 comments

Comments

@sisp
Copy link

sisp commented Oct 22, 2020

Expected Behaviour

of-watchdog should be configurable using CLI flags instead of environment variables.

Current Behaviour

of-watchdog is only configurable using environment variables.

Possible Solution

Add CLI flags for configuration. To retain backward compatibility, environment variables can be used when no CLI flags are provided. If at least one CLI flag is provided, environment variables should be ignored and the default value of any unprovided CLI flag should be used instead.

Context

of-watchdog starts a webserver in a child process, i.e. of-watchdog and the actual webserver run in the same environment (typically a Docker container). It is possible (and likely) that the webserver is also configured using environment variables, and there is a chance that some environment variables are the same for of-watchdog and the webserver. This can lead to a bad configuration, e.g. if the webserver uses the environment variable port (which is used by of-watchdog, too), of-watchdog is configured to listen on the same port as the webserver which (a) is unexpected and (b) leads to a port collision.

@alexellis
Copy link
Member

Hi @sisp environment variables are used to configure 12-factor apps rather than flags.

I would consider the variables used in the watchdog as reserved.

Unless you have a concrete problem, where this is clashing for you and causing an issue, I'd suggest we leave things as they are and close this issue.

Thank you for your concern.

Alex

@sisp
Copy link
Author

sisp commented Oct 22, 2020

Hi @alexellis, I automatically extend user-provided Docker images with of-watchdog, so they can be deployed to OpenFaaS without additional effort for the user. I could declare the of-watchdog variables as reserved, but I don't think this is a clean solution because from a user's perspective of-watchdog doesn't exist and I'd like it to be only an implementation detail of my "platform".

If you have a strong opinion about using environment variables, how about prefixing the of-watchdog variables, e.g. of_watchdog_*, to reduce the chances of name collisions? This would be a breaking change to be effective, though.

@alexellis
Copy link
Member

I'm unaware of your usage of OpenFaaS and this is the first time we've heard from you. It may make your case stronger, if you're seen to participate in the community and build some goodwill and relationship with the community.

For your reference, here are a list of environment variables in use.

https://github.com/openfaas/of-watchdog#configuration

If you can show this to be a genuine problem rather than a hypothesis, we would give it some more thought. So far this hasn't been any issue that we've been aware of by any of our users.

Alex

@sisp
Copy link
Author

sisp commented Oct 22, 2020

I'm unaware of your usage of OpenFaaS and this is the first time we've heard from you. It may make your case stronger, if you're seen to participate in the community and build some goodwill and relationship with the community.

That's true, I've been using OpenFaaS for about a year and it has worked great so far, so there was no need to engage on GitHub. But I'm happy to discuss with the larger community about my case.

For your reference, here are a list of environment variables in use.

https://github.com/openfaas/of-watchdog#configuration

Thanks for referencing the configuration list. I'm aware of it and understand how of-watchdogworks.

If you can show this to be a genuine problem rather than a hypothesis, we would give it some more thought. So far this hasn't been any issue that we've been aware of by any of our users.

I'm building a small wrapper CLI around faas-cli deploy to allow users to deploy their already dockerized web services to OpenFaaS without the need to explicitly add of-watchdog. In fact, they shouldn't even know what of-watchdog is, how it works, and that it is needed. To them, my CLI is just a CLI to deploy a Docker image to a platform. Therefore, I'd like to avoid unexpected side effects due to environment variables needed to configure of-watchdog that could collide with environment variables of the users' Docker images.

Does this make my case a bit clearer? 🙂

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

2 participants