feat!: config for auth providers now use a map instead of an array

The config values for openid providers now use a map with the provider as key instead of an array. For example before:

auth:
  openid:
    providers:
      - name: foo
        clientid: ...

now becomes:

auth:
  openid:
    providers:
      foo:
        clientid: ...

This allows us to read values for openid providers from files using the same syntax as everywhere and makes the configuration more predictable. It also allows configuring providers through env variables, though it is still required to set at least one value via the config file because Vikunja won't discover the provider otherwise.
This commit is contained in:
kolaente
2024-11-18 10:34:30 +01:00
parent 3479fa1228
commit 05349ddb5c
6 changed files with 47 additions and 36 deletions

View File

@@ -443,6 +443,10 @@ func getConfigValueFromFile(configKey string) string {
func readConfigValuesFromFiles() {
keys := viper.AllKeys()
for _, key := range keys {
if strings.Contains(key, "auth.openid.providers") {
// Setting openid provider values will remove everything but the value from file
continue
}
// Env is evaluated manually at runtime, so we need to check this for each key
value := getConfigValueFromFile(key + ".file")
if value != "" {