mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-01 01:41:13 -06:00
directly pass env to config
This commit is contained in:
@@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"os"
|
||||
|
||||
"github.com/imdario/mergo"
|
||||
"github.com/owncloud/ocis/accounts/pkg/config"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/version"
|
||||
@@ -79,13 +78,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
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"os"
|
||||
|
||||
"github.com/imdario/mergo"
|
||||
"github.com/owncloud/ocis/glauth/pkg/config"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/version"
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
2
go.mod
2
go.mod
@@ -35,7 +35,6 @@ require (
|
||||
github.com/gorilla/mux v1.8.0
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.2
|
||||
github.com/iancoleman/strcase v0.2.0
|
||||
github.com/imdario/mergo v0.3.12
|
||||
github.com/justinas/alice v1.2.0
|
||||
github.com/libregraph/lico v0.53.1
|
||||
github.com/mennanov/fieldmask-utils v0.5.0
|
||||
@@ -151,6 +150,7 @@ require (
|
||||
github.com/hashicorp/go-plugin v1.4.3 // indirect
|
||||
github.com/hashicorp/yamux v0.0.0-20211028200310-0bc27b27de87 // indirect
|
||||
github.com/huandu/xstrings v1.3.2 // indirect
|
||||
github.com/imdario/mergo v0.3.12 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.0.0 // indirect
|
||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
|
||||
github.com/jmespath/go-jmespath v0.4.0 // indirect
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"os"
|
||||
|
||||
"github.com/imdario/mergo"
|
||||
"github.com/owncloud/ocis/graph-explorer/pkg/config"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/version"
|
||||
@@ -56,7 +55,7 @@ func ParseConfig(c *cli.Context, cfg *config.Config) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// provide with defaults for shared logging, since we need a valid destination address for BindEnv.
|
||||
// provide with defaults for shared logging, since we need a valid destination address for BindEnv.
|
||||
if cfg.Log == nil && cfg.Commons != nil && cfg.Commons.Log != nil {
|
||||
cfg.Log = &config.Log{
|
||||
Level: cfg.Commons.Log.Level,
|
||||
@@ -69,13 +68,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
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"os"
|
||||
|
||||
"github.com/imdario/mergo"
|
||||
"github.com/thejerf/suture/v4"
|
||||
"github.com/wkloucek/envdecode"
|
||||
|
||||
@@ -70,13 +69,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
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"os"
|
||||
|
||||
"github.com/imdario/mergo"
|
||||
"github.com/owncloud/ocis/idp/pkg/config"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/version"
|
||||
@@ -72,13 +71,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
|
||||
}
|
||||
|
||||
|
||||
@@ -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/ocs/pkg/config"
|
||||
@@ -73,13 +72,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
|
||||
}
|
||||
|
||||
|
||||
@@ -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/proxy/pkg/config"
|
||||
@@ -72,13 +71,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
|
||||
}
|
||||
|
||||
|
||||
@@ -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/settings/pkg/config"
|
||||
@@ -73,13 +72,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
|
||||
}
|
||||
|
||||
|
||||
@@ -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/store/pkg/config"
|
||||
@@ -60,7 +59,7 @@ func ParseConfig(c *cli.Context, cfg *config.Config) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// provide with defaults for shared logging, since we need a valid destination address for BindEnv.
|
||||
// provide with defaults for shared logging, since we need a valid destination address for BindEnv.
|
||||
if cfg.Log == nil && cfg.Commons != nil && cfg.Commons.Log != nil {
|
||||
cfg.Log = &config.Log{
|
||||
Level: cfg.Commons.Log.Level,
|
||||
@@ -73,13 +72,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
|
||||
}
|
||||
|
||||
|
||||
@@ -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/thumbnails/pkg/config"
|
||||
@@ -73,16 +72,9 @@ 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" {
|
||||
if err := envdecode.Decode(cfg); 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 {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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/webdav/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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user