Configuring openid via env variables is currently not supported. You’ll need to use a config file for that. It is possible to use both env and config files at the same time, that way you could put only the openid config in the config file and use env variables for the rest.
Just one follow-up question: is it possible to expand environment variables in the config file? The point is that I don’t want to put the openid clientsecret into the config file (I’m using a docker-compose setup with all files but .env in git).
I would also be interested in this.
In nixos, the config file will be world readable in the nix store. Using environment variables is the only secure way of passing those secrets to the service.
@Rohmilchkaese that helm you pasted, are the envs like VIKUNJA_OIDC_CLIENT_SECRET being used anywhere? It looks like below a ConfigMap is generated with the raw clientsecret.
I’m using flux w/ sealed secrets so I can put them in git. However, I cannot figure out a way to deploy this app without exposing the clientsecret in my repository. The environment variables would be perfect, I can set them, but I’m not sure how I can get clientsecret set to them.
The problem is that environment variables are evaluated at runtime. That means Vikunja will first make a list of all configured openid providers and then check the credentials for each of them. But at the time where it makes the list, environment variables are not evaluated. That’s caused by viper, the library Vikunja uses to make handling config variables easier.
It might be possible to build this, but it’s not as easy and would likely require rearchitecting the way the config is read. IMHO such a change should be made directly in viper, not in Vikunja.
I took a stab at this and noticed a few things that might be relevant:
That commit hasn’t made it into a tagged release yet. The only place I don’t get that panic is if I run the unstable tag. You may already know this, but if (like me) you stumble on this thread with the same issue, be aware that at time of writing, it’s not released yet (despite being in the docs).
An error is thrown in the logs if you don’t specify the clientid and clientsecret, even if they’re provided in environment variables. The app still initializes and the server comes up, but the button to use the OIDC provider is gone, which appears to be due to this commit. I tried setting those values to an empty string and overriding them from the environment, but it looks like it didn’t take. I do wonder if perhaps I didn’t specify the env variables quite correctly.
For reference, I’m in a k8s environment using xeruf’s fork of the official helm chart. This is a bit of a security concern for me. I know there is technically a way around it by specifying them with files in the config and mounting the secrets to those files, but I haven’t figured out how to negotiate with the helm chart to get that to work. Any advice here would be greatly appreciated.
I’ve just pushed a fix for this in 5c02527d2d. Environment variables are now read explicitly, instead of on-demand. This allows specifying the OpenID config entirely using env variables, without a config file at all.
Please check with the next unstable build (should be ready for deployment in ~45min, also on try).