movio / bramble

A federated GraphQL API gateway
https://movio.github.io/bramble/
MIT License
497 stars 55 forks source link

Read Configuration from Environment Variable #129

Closed yaronp closed 2 years ago

yaronp commented 2 years ago

Allow to inject configuration JSON block as environment variable.

This will allow us to setup parameters dynamically in manifest.

pkqk commented 2 years ago

@yaronp are you using kubernetes or another orchestrator?

On our kubernetes setup we have a ConfigMap that contains the configuration files, we mount this as a volume into the container of the Deployment. Then if the ConfigMap is updated you can either roll out a restart of the Deployment or what we do is rely on the fact that fsnotify will watch for updates of the config files, we update an annotation on the Deployment after updating the ConfigMap and this will trigger the volume mount to update based on the ConfigMap.

Given the size of the config file I wouldn't want to inject all of it in via an environment variable as it's difficult to escape JSON reliably in a json or yaml manifest file.