dendrite icon indicating copy to clipboard operation
dendrite copied to clipboard

Configuration by Environment Variables

Open genofire opened this issue 3 years ago • 8 comments

Problem:

In a K8s it is really common to run dependencies by other applications like an database operator (zalando's postgres operator). Which generates k8s secrets, for credentials like username and password.

It would be nice to use them directly (instatt of generate configfiles, stored in new k8s secrets with helm or other tooling). Therefore exists the possibility to use envFromSecrets in k8s deployments.

Description/Solution:

So please make it possible to give dendrite configuration parameters with env variables.

Implemented Suggested:

Maybe you like to use the golang library viper and cobra from spf13 for it.

genofire avatar Jul 24 '22 18:07 genofire

Previously discussed in #1958, #393.

neilalexander avatar Jul 25 '22 09:07 neilalexander

Oh sorry, have not looked after closed/rejected issues :(

Sad, will you accept MRs with Viper? If somebody else dies it?

genofire avatar Jul 25 '22 10:07 genofire

The conclusion we've come to in the past is that we might end up doing this in the future, but we probably won't do it now. This increases the configuration surface area considerably and the configuration format isn't completely stable yet anyway, so it's easier for us to deal with one thing for now: the configuration file.

neilalexander avatar Jul 25 '22 10:07 neilalexander

In best, only structure should be used for everything and env-variables names should be generetes (like the yaml from the same struct)

The question is, are you willing to merge a PR, if it make nothing change for the way of yaml-file structure and internel config struct ... just the parsing of env variables also.

genofire avatar Jul 25 '22 11:07 genofire

@neilalexander i started to implement a solution. if i finish it would you merge?

Any suggestion / tips for easier review later?

genofire avatar Aug 12 '22 16:08 genofire

We intend to officially support k8s/Helm environments in the future. This means we will be heading in the direction of configuration with env vars, but we aren't there yet. The aforementioned concerns remain valid:

This increases the configuration surface area considerably and the configuration format isn't completely stable yet anyway, so it's easier for us to deal with one thing for now: the configuration file.

Especially with our team smaller than before, we cannot devote time to extending the configuration surface area at this time unfortunately.

kegsay avatar Dec 06 '22 14:12 kegsay

What do you think about piping a raw yaml config content over something like envsubst in go. @kegsay

reddec avatar Aug 09 '23 04:08 reddec

thats what the koanf PR hase done ...

genofire avatar Aug 14 '23 13:08 genofire