Think of an environment variable like DB_URL which many microservices are using. Let's say that the value of the environment variable could change.
I want this variable to be stored in a single place (say like Consul) and not be stored as a .json or yml file within the repos of the microservices.
What's the best way to go about this?
I was on a talk at weardevelopers.com from the CTO of BWin and they actually version the configs in their own config service.
they even have a json key { app: 'name', version: 'v3' } so maybe just using a versionservice with a websocket where you can push such info? a classic bus distribution so to say to update and bootstrap the services in runtime?
those would be my thoughts. you could just basically have a 'dumb' http server that basically just returns a static json and has only 1 endpoint.
which you pass as an CLI or ENV parameter.
you could also just create seperate isolated configs and deploy them via puppet or ansible or fabric.
If Docker is your thing, you can use environment variable substitution in your docker-compose.yml, e.g. ${DB_URL}. Docker Swarm has something called secrets, as does Kubernetes.
Full Stack Dev at Agentdesks | Ex Hashnode | Ex Shippable | Ex Altair Engineering
Matt Strom
Software Engineer, TypeScript ninja
I have yet to find a "standardized" way of doing this. I've had to devise my own so far. Storing env vars on a build server helps.
However, I did recently discover a system called Vault by Hashicorp, same company behind Terraform. It's a secure key server mainly meant for secrets management, but I see no reason why you couldn't use it for other environment variables.