absmach / magistrala

Industrial IoT Messaging and Device Management Platform
https://www.abstractmachines.fr/magistrala.html
Apache License 2.0
2.46k stars 667 forks source link

Enable service configuration by using configuration files #435

Open ghost opened 5 years ago

ghost commented 5 years ago

FEATURE REQUEST

  1. 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.

  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.

  1. 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.

ghost commented 5 years ago

I would advise checking viper, since it can read environment variables and also read configuration files in several formats

drasko commented 5 years ago

Agreed - Viper looks like a nice tool for the job.

drasko commented 5 years ago

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?

drasko commented 4 years ago

Also - if we leave both solutions - ENV and .config files if present (or used with a --config switch), this might be the best option.

chombium commented 4 years ago

@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

drasko commented 4 years ago

@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.

manuio commented 4 years ago

@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 ?

nmarcetic commented 4 years ago

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!

manuio commented 4 years ago

Reopening this one to finish services implementation

cyber-goka commented 1 year ago

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

drasko commented 1 year ago

@cyber-goka we use k8s for professional deployments and docker-compose for dev, so no problems with service discovery.

cyber-goka commented 1 year ago

got it, thanks