magistrala
magistrala copied to clipboard
Enable service configuration by using configuration files
FEATURE REQUEST
-
Is there an open issue addressing this request? If it does, please add a "+1" reaction to the existing issue, otherwise proceed to step 2.
-
Describe the feature you are requesting, as well as the possible use case(s) for it.
Currently, services are configured by setting environment variables, or by defaults if variables are not set. It would be nice to be able to supply a configuration file to the service as well.
- Indicate the importance of this feature to you (must-have, should-have, nice-to-have).
This is a nice to have feature, especially in cases when someone runs a service outside a docker container.
I would advise checking viper, since it can read environment variables and also read configuration files in several formats
Agreed - Viper looks like a nice tool for the job.
I am not sure that we need this one. Config files are more difficult to distribute (although not much more), and we have nice solution no with .env.
@nmarcetic @anovakovic01 opinions?
Also - if we leave both solutions - ENV and .config
files if present (or used with a --config
switch), this might be the best option.
@mainflux/contributors do we really need two ways for configuration? IMHO we should have one and only one way for configuration. I personally don't like systems where a same functionality can be achieved in many different ways as it confuses the users and it makes the implementation more complex
@chombium my opinion is that config via ENV variables is the best approach, but it would not bother me if config files and command line switches exist as an alternative.
I just think that this is really not necessary and makes things harder to maintain.
@drasko We solved the problem for docker but natively it still complicated to setup the system (if you're not using default one, of course) because there are many duplicated variables all around the code.
How hard it would be to remove all definitions from main.go and copy the values from the same file used for Docker .env
?
I agree with @srados I would use Viper to read config files and/or ENV var. So would support bought config + env, it would be great!
Reopening this one to finish services implementation
idk if it is relevant but in microservices architecture, it is very common to use discovery + config servers such as a consul, it can even store passwords if integrated with the vault. provisioning in k8s, docker-compose will be easier. also can implement service discovery with consul
@cyber-goka we use k8s for professional deployments and docker-compose for dev, so no problems with service discovery.
got it, thanks