directly pass env to config

This commit is contained in:
Willy Kloucek
2021-12-17 16:54:26 +01:00
parent 7abcf96ea8
commit 2bcd4f5a17
13 changed files with 15 additions and 100 deletions

View File

@@ -4,7 +4,6 @@ import (
"context"
"os"
"github.com/imdario/mergo"
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis-pkg/version"
"github.com/owncloud/ocis/web/pkg/config"
@@ -71,13 +70,7 @@ func ParseConfig(c *cli.Context, cfg *config.Config) error {
}
// load all env variables relevant to the config in the current context.
envCfg := config.Config{}
if err := envdecode.Decode(&envCfg); err != nil && err.Error() != "none of the target fields were set from environment variables" {
return err
}
// merge environment variable config on top of the current config
if err := mergo.Merge(cfg, envCfg, mergo.WithOverride); err != nil {
if err := envdecode.Decode(cfg); err != nil && err.Error() != "none of the target fields were set from environment variables" {
return err
}