-
Notifications
You must be signed in to change notification settings - Fork 293
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Env variables for configuration #575
Comments
@koalalorenzo so you want to override options from the configuration using env variables? would you also have cluster update the configuration with the new values then or just use them? Would perhaps an Are you mostly bothered by |
No, the The idea is that (when possible) a value for the configuration is passed via env variable. This is including Basically, if there is a env variable and the configuration file is present, the env variable should have priority. Changing the file doesn't matter as long as the software behaves as the env variables are specifying. Is this helping? |
@koalalorenzo wait, is go-ipfs doing it right or not? I don't think it supports env variables. |
|
@koalalorenzo unfortunately, viper is too big of a jump from how we do config mngt in cluster atm. I am going to just add in reading from the environment with envconfig for now. How do you currently manage the env vars of a process currently, i.e. Consul? |
@lanzafame no, don't do envconfig. It overlaps with I think we should just have |
@hsanjuan we don't define flags for a lot of the service.json file though? |
No.. honestly it's still unclear to me why the cluster secret would need updating after init (which does take a Also, doing this per component makes Overall I'm asking to take minimal a approach because I'm not sure what the best approach is in terms of functionality, documentation, code organization and maintainability (supporting all config via env variables is essentially supporting a parallel |
The way I implemented it in #596 is that at the time of load the service.json file, we check if there are any overriding env vars and use those instead of what is in the service.json. And it is just for the life of that instance, the override value doesn't get saved to the json file. |
If we do this, it should:
But doing this per component we cannot have a the full config overview that |
So to add some context, I want to be able to set the metrics and tracing configuration values prior to the invocation of the I have been thinking about the differences between file, env, and flag configuration and my current thoughts are that file and env configuration options should be the same and encompass the entire set of configuration options, whereas flag should be the subset of configuration options that change or add code paths to operation of the command, i.e. |
@lanzafame yes ok, let's go ahead |
Change the configuration from the env without any static config file, volumes or mounts. In case of security breach, changing just the env variables would be much easier than going inside each single volumes and changing the value of the files. Is this a valid use case? There are more to point to I would like to have at least |
This is a feature request.
The hardest part of maintaining
ipfs-cluster
is changing the configuration "on the fly" by changing the env variables. This is quiet common in docker containers which I am extensively using.Most of the configuration now lives into its own file, and can't be changed after running the first init, and even by adding
-f
. For example if you need to change theCLUSTER_SECRET
variable, and keep persistency, you need to force a new initialisation or delete theservice.json
fileWhat would be nice to have is the configuration to get updated based on the environment variables. The
CLUSTER_SECRET
is one quick-win, easy example, but it can be applied to several different cases (ex: bootstrapping vs pre-defined peers).This can be implemented in different ways:
-f init
each restartThe text was updated successfully, but these errors were encountered: