diff --git a/accounts/pkg/command/server.go b/accounts/pkg/command/server.go index acbb7fcd8..8fc613601 100644 --- a/accounts/pkg/command/server.go +++ b/accounts/pkg/command/server.go @@ -32,9 +32,7 @@ func Server(cfg *config.Config) *cli.Command { // When running on single binary mode the before hook from the root command won't get called. We manually // call this before hook from ocis command, so the configuration can be loaded. - if !cfg.Supervised { - return ParseConfig(ctx, cfg) - } + return ParseConfig(ctx, cfg) if origins := ctx.StringSlice("cors-allowed-origins"); len(origins) != 0 { cfg.HTTP.CORS.AllowedOrigins = origins } diff --git a/accounts/pkg/config/config.go b/accounts/pkg/config/config.go index 57673bd9c..2ca48d58f 100644 --- a/accounts/pkg/config/config.go +++ b/accounts/pkg/config/config.go @@ -265,164 +265,3 @@ func (c *Config) UnmapEnv(gooconf *gofig.Config) error { return nil } - -type mapping struct { - EnvVars []string // name of the EnvVars var. - Destination interface{} // memory address of the original config value to modify. -} - -// structMappings binds a set of environment variables to a destination on cfg. -func structMappings(cfg *Config) []mapping { - return []mapping{ - { - EnvVars: []string{"ACCOUNTS_LOG_FILE", "OCIS_LOG_FILE"}, - Destination: &cfg.Log.File, - }, - { - EnvVars: []string{"ACCOUNTS_TRACING_ENABLED", "OCIS_TRACING_ENABLED"}, - Destination: &cfg.Tracing.Enabled, - }, - { - EnvVars: []string{"ACCOUNTS_TRACING_TYPE", "OCIS_TRACING_TYPE"}, - Destination: &cfg.Tracing.Type, - }, - { - EnvVars: []string{"ACCOUNTS_TRACING_ENDPOINT", "OCIS_TRACING_ENDPOINT"}, - Destination: &cfg.Tracing.Endpoint, - }, - { - EnvVars: []string{"ACCOUNTS_TRACING_COLLECTOR", "OCIS_TRACING_COLLECTOR"}, - Destination: &cfg.Tracing.Collector, - }, - { - EnvVars: []string{"ACCOUNTS_TRACING_SERVICE"}, - Destination: &cfg.Tracing.Service, - }, - { - EnvVars: []string{"ACCOUNTS_HTTP_NAMESPACE"}, - Destination: &cfg.HTTP.Namespace, - }, - { - EnvVars: []string{"ACCOUNTS_HTTP_ADDR"}, - Destination: &cfg.HTTP.Addr, - }, - { - EnvVars: []string{"ACCOUNTS_HTTP_ROOT"}, - Destination: &cfg.HTTP.Root, - }, - { - EnvVars: []string{"ACCOUNTS_CACHE_TTL"}, - Destination: &cfg.HTTP.CacheTTL, - }, - { - EnvVars: []string{"ACCOUNTS_GRPC_NAMESPACE"}, - Destination: &cfg.GRPC.Namespace, - }, - { - EnvVars: []string{"ACCOUNTS_GRPC_ADDR"}, - Destination: &cfg.GRPC.Addr, - }, - { - EnvVars: []string{"ACCOUNTS_NAME"}, - Destination: &cfg.Server.Name, - }, - { - EnvVars: []string{"ACCOUNTS_HASH_DIFFICULTY"}, - Destination: &cfg.Server.HashDifficulty, - }, - { - EnvVars: []string{"ACCOUNTS_DEMO_USERS_AND_GROUPS"}, - Destination: &cfg.Server.DemoUsersAndGroups, - }, - { - EnvVars: []string{"ACCOUNTS_ASSET_PATH"}, - Destination: &cfg.Asset.Path, - }, - { - EnvVars: []string{"ACCOUNTS_JWT_SECRET", "OCIS_JWT_SECRET"}, - Destination: &cfg.TokenManager.JWTSecret, - }, - { - EnvVars: []string{"ACCOUNTS_STORAGE_BACKEND"}, - Destination: &cfg.Repo.Backend, - }, - { - EnvVars: []string{"ACCOUNTS_STORAGE_DISK_PATH"}, - Destination: &cfg.Repo.Disk.Path, - }, - { - EnvVars: []string{"ACCOUNTS_STORAGE_CS3_PROVIDER_ADDR"}, - Destination: &cfg.Repo.CS3.ProviderAddr, - }, - { - EnvVars: []string{"ACCOUNTS_STORAGE_CS3_DATA_URL"}, - Destination: &cfg.Repo.CS3.DataURL, - }, - { - EnvVars: []string{"ACCOUNTS_STORAGE_CS3_DATA_PREFIX"}, - Destination: &cfg.Repo.CS3.DataPrefix, - }, - { - EnvVars: []string{"ACCOUNTS_STORAGE_CS3_JWT_SECRET", "OCIS_JWT_SECRET"}, - Destination: &cfg.Repo.CS3.JWTSecret, - }, - { - EnvVars: []string{"ACCOUNTS_SERVICE_USER_UUID"}, - Destination: &cfg.ServiceUser.UUID, - }, - { - EnvVars: []string{"ACCOUNTS_SERVICE_USER_USERNAME"}, - Destination: &cfg.ServiceUser.Username, - }, - { - EnvVars: []string{"ACCOUNTS_SERVICE_USER_UID"}, - Destination: &cfg.ServiceUser.UID, - }, - { - EnvVars: []string{"ACCOUNTS_SERVICE_USER_GID"}, - Destination: &cfg.ServiceUser.GID, - }, - { - EnvVars: []string{"ACCOUNTS_UID_INDEX_LOWER_BOUND"}, - Destination: &cfg.Index.UID.Lower, - }, - { - EnvVars: []string{"ACCOUNTS_GID_INDEX_LOWER_BOUND"}, - Destination: &cfg.Index.GID.Lower, - }, - { - EnvVars: []string{"ACCOUNTS_UID_INDEX_UPPER_BOUND"}, - Destination: &cfg.Index.UID.Upper, - }, - { - EnvVars: []string{"ACCOUNTS_GID_INDEX_UPPER_BOUND"}, - Destination: &cfg.Index.GID.Upper, - }, - } -} - -// TODO(refs) What is with the variables with no destination defined? -//&cli.StringSliceFlag{ -//Name: "cors-allowed-origins", -//Value: cli.NewStringSlice("*"), -//Usage: "Set the allowed CORS origins", -//EnvVars: []string{"ACCOUNTS_CORS_ALLOW_ORIGINS", "OCIS_CORS_ALLOW_ORIGINS"}, -//}, -//&cli.StringSliceFlag{ -//Name: "cors-allowed-methods", -//Value: cli.NewStringSlice("GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"), -//Usage: "Set the allowed CORS origins", -//EnvVars: []string{"ACCOUNTS_CORS_ALLOW_METHODS", "OCIS_CORS_ALLOW_METHODS"}, -//}, -//&cli.StringSliceFlag{ -//Name: "cors-allowed-headers", -//Value: cli.NewStringSlice("Authorization", "Origin", "Content-Type", "Accept", "X-Requested-With"), -//Usage: "Set the allowed CORS origins", -//EnvVars: []string{"ACCOUNTS_CORS_ALLOW_HEADERS", "OCIS_CORS_ALLOW_HEADERS"}, -//}, -//&cli.BoolFlag{ -//Name: "cors-allow-credentials", -//Value: flags.OverrideDefaultBool(cfg.HTTP.CORS.AllowCredentials, true), -//Usage: "Allow credentials for CORS", -//EnvVars: []string{"ACCOUNTS_CORS_ALLOW_CREDENTIALS", "OCIS_CORS_ALLOW_CREDENTIALS"}, -//}, diff --git a/accounts/pkg/config/env.go b/accounts/pkg/config/env.go new file mode 100644 index 000000000..6b5e39c13 --- /dev/null +++ b/accounts/pkg/config/env.go @@ -0,0 +1,162 @@ +package config + +type mapping struct { + EnvVars []string // name of the EnvVars var. + Destination interface{} // memory address of the original config value to modify. +} + +// structMappings binds a set of environment variables to a destination on cfg. +func structMappings(cfg *Config) []mapping { + return []mapping{ + { + EnvVars: []string{"ACCOUNTS_LOG_FILE", "OCIS_LOG_FILE"}, + Destination: &cfg.Log.File, + }, + { + EnvVars: []string{"ACCOUNTS_TRACING_ENABLED", "OCIS_TRACING_ENABLED"}, + Destination: &cfg.Tracing.Enabled, + }, + { + EnvVars: []string{"ACCOUNTS_TRACING_TYPE", "OCIS_TRACING_TYPE"}, + Destination: &cfg.Tracing.Type, + }, + { + EnvVars: []string{"ACCOUNTS_TRACING_ENDPOINT", "OCIS_TRACING_ENDPOINT"}, + Destination: &cfg.Tracing.Endpoint, + }, + { + EnvVars: []string{"ACCOUNTS_TRACING_COLLECTOR", "OCIS_TRACING_COLLECTOR"}, + Destination: &cfg.Tracing.Collector, + }, + { + EnvVars: []string{"ACCOUNTS_TRACING_SERVICE"}, + Destination: &cfg.Tracing.Service, + }, + { + EnvVars: []string{"ACCOUNTS_HTTP_NAMESPACE"}, + Destination: &cfg.HTTP.Namespace, + }, + { + EnvVars: []string{"ACCOUNTS_HTTP_ADDR"}, + Destination: &cfg.HTTP.Addr, + }, + { + EnvVars: []string{"ACCOUNTS_HTTP_ROOT"}, + Destination: &cfg.HTTP.Root, + }, + { + EnvVars: []string{"ACCOUNTS_CACHE_TTL"}, + Destination: &cfg.HTTP.CacheTTL, + }, + { + EnvVars: []string{"ACCOUNTS_GRPC_NAMESPACE"}, + Destination: &cfg.GRPC.Namespace, + }, + { + EnvVars: []string{"ACCOUNTS_GRPC_ADDR"}, + Destination: &cfg.GRPC.Addr, + }, + { + EnvVars: []string{"ACCOUNTS_NAME"}, + Destination: &cfg.Server.Name, + }, + { + EnvVars: []string{"ACCOUNTS_HASH_DIFFICULTY"}, + Destination: &cfg.Server.HashDifficulty, + }, + { + EnvVars: []string{"ACCOUNTS_DEMO_USERS_AND_GROUPS"}, + Destination: &cfg.Server.DemoUsersAndGroups, + }, + { + EnvVars: []string{"ACCOUNTS_ASSET_PATH"}, + Destination: &cfg.Asset.Path, + }, + { + EnvVars: []string{"ACCOUNTS_JWT_SECRET", "OCIS_JWT_SECRET"}, + Destination: &cfg.TokenManager.JWTSecret, + }, + { + EnvVars: []string{"ACCOUNTS_STORAGE_BACKEND"}, + Destination: &cfg.Repo.Backend, + }, + { + EnvVars: []string{"ACCOUNTS_STORAGE_DISK_PATH"}, + Destination: &cfg.Repo.Disk.Path, + }, + { + EnvVars: []string{"ACCOUNTS_STORAGE_CS3_PROVIDER_ADDR"}, + Destination: &cfg.Repo.CS3.ProviderAddr, + }, + { + EnvVars: []string{"ACCOUNTS_STORAGE_CS3_DATA_URL"}, + Destination: &cfg.Repo.CS3.DataURL, + }, + { + EnvVars: []string{"ACCOUNTS_STORAGE_CS3_DATA_PREFIX"}, + Destination: &cfg.Repo.CS3.DataPrefix, + }, + { + EnvVars: []string{"ACCOUNTS_STORAGE_CS3_JWT_SECRET", "OCIS_JWT_SECRET"}, + Destination: &cfg.Repo.CS3.JWTSecret, + }, + { + EnvVars: []string{"ACCOUNTS_SERVICE_USER_UUID"}, + Destination: &cfg.ServiceUser.UUID, + }, + { + EnvVars: []string{"ACCOUNTS_SERVICE_USER_USERNAME"}, + Destination: &cfg.ServiceUser.Username, + }, + { + EnvVars: []string{"ACCOUNTS_SERVICE_USER_UID"}, + Destination: &cfg.ServiceUser.UID, + }, + { + EnvVars: []string{"ACCOUNTS_SERVICE_USER_GID"}, + Destination: &cfg.ServiceUser.GID, + }, + { + EnvVars: []string{"ACCOUNTS_UID_INDEX_LOWER_BOUND"}, + Destination: &cfg.Index.UID.Lower, + }, + { + EnvVars: []string{"ACCOUNTS_GID_INDEX_LOWER_BOUND"}, + Destination: &cfg.Index.GID.Lower, + }, + { + EnvVars: []string{"ACCOUNTS_UID_INDEX_UPPER_BOUND"}, + Destination: &cfg.Index.UID.Upper, + }, + { + EnvVars: []string{"ACCOUNTS_GID_INDEX_UPPER_BOUND"}, + Destination: &cfg.Index.GID.Upper, + }, + } +} + +// TODO(refs) What is with the variables with no destination defined? +//&cli.StringSliceFlag{ +//Name: "cors-allowed-origins", +//Value: cli.NewStringSlice("*"), +//Usage: "Set the allowed CORS origins", +//EnvVars: []string{"ACCOUNTS_CORS_ALLOW_ORIGINS", "OCIS_CORS_ALLOW_ORIGINS"}, +//}, +//&cli.StringSliceFlag{ +//Name: "cors-allowed-methods", +//Value: cli.NewStringSlice("GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"), +//Usage: "Set the allowed CORS origins", +//EnvVars: []string{"ACCOUNTS_CORS_ALLOW_METHODS", "OCIS_CORS_ALLOW_METHODS"}, +//}, +//&cli.StringSliceFlag{ +//Name: "cors-allowed-headers", +//Value: cli.NewStringSlice("Authorization", "Origin", "Content-Type", "Accept", "X-Requested-With"), +//Usage: "Set the allowed CORS origins", +//EnvVars: []string{"ACCOUNTS_CORS_ALLOW_HEADERS", "OCIS_CORS_ALLOW_HEADERS"}, +//}, +//&cli.BoolFlag{ +//Name: "cors-allow-credentials", +//Value: flags.OverrideDefaultBool(cfg.HTTP.CORS.AllowCredentials, true), +//Usage: "Allow credentials for CORS", +//EnvVars: []string{"ACCOUNTS_CORS_ALLOW_CREDENTIALS", "OCIS_CORS_ALLOW_CREDENTIALS"}, +//}, diff --git a/graph/pkg/command/root.go b/graph/pkg/command/root.go index cfe7783c9..67e6103da 100644 --- a/graph/pkg/command/root.go +++ b/graph/pkg/command/root.go @@ -3,16 +3,13 @@ package command import ( "context" "os" - "strings" - "github.com/owncloud/ocis/ocis-pkg/sync" "github.com/thejerf/suture/v4" "github.com/owncloud/ocis/graph/pkg/config" ociscfg "github.com/owncloud/ocis/ocis-pkg/config" "github.com/owncloud/ocis/ocis-pkg/log" "github.com/owncloud/ocis/ocis-pkg/version" - "github.com/spf13/viper" "github.com/urfave/cli/v2" ) @@ -31,8 +28,6 @@ func Execute(cfg *config.Config) error { }, }, - //Flags: flagset.RootWithConfig(cfg), - Before: func(c *cli.Context) error { cfg.Server.Version = version.String return ParseConfig(c, cfg) @@ -68,46 +63,18 @@ func NewLogger(cfg *config.Config) log.Logger { ) } -// ParseConfig reads graph configuration from fs. +// ParseConfig loads proxy configuration from known paths. func ParseConfig(c *cli.Context, cfg *config.Config) error { - sync.ParsingViperConfig.Lock() - defer sync.ParsingViperConfig.Unlock() - logger := NewLogger(cfg) - - viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_")) - viper.SetEnvPrefix("GRAPH") - viper.AutomaticEnv() - - if c.IsSet("config-file") { - viper.SetConfigFile(c.String("config-file")) - } else { - viper.SetConfigName("graph") - - viper.AddConfigPath("/etc/ocis") - viper.AddConfigPath("$HOME/.ocis") - viper.AddConfigPath("./config") + conf, err := ociscfg.BindSourcesToStructs("graph", cfg) + if err != nil { + return err } - if err := viper.ReadInConfig(); err != nil { - switch err.(type) { - case viper.ConfigFileNotFoundError: - //logger.Info(). - // Msg("Continue without config") - case viper.UnsupportedConfigError: - logger.Fatal(). - Err(err). - Msg("Unsupported config type") - default: - logger.Fatal(). - Err(err). - Msg("Failed to read config") - } - } + // load all env variables relevant to the config in the current context. + conf.LoadOSEnv(config.GetEnv(), false) - if err := viper.Unmarshal(&cfg); err != nil { - logger.Fatal(). - Err(err). - Msg("Failed to parse config") + if err = cfg.UnmapEnv(conf); err != nil { + return err } return nil diff --git a/graph/pkg/command/server.go b/graph/pkg/command/server.go index fb649db7b..91ca8960a 100644 --- a/graph/pkg/command/server.go +++ b/graph/pkg/command/server.go @@ -29,9 +29,7 @@ func Server(cfg *config.Config) *cli.Command { // When running on single binary mode the before hook from the root command won't get called. We manually // call this before hook from ocis command, so the configuration can be loaded. - if !cfg.Supervised { - return ParseConfig(ctx, cfg) - } + return ParseConfig(ctx, cfg) logger.Debug().Str("service", "graph").Msg("ignoring config file parsing when running supervised") return nil }, diff --git a/graph/pkg/config/config.go b/graph/pkg/config/config.go index d766029db..c59d69dcb 100644 --- a/graph/pkg/config/config.go +++ b/graph/pkg/config/config.go @@ -1,72 +1,78 @@ package config -import "context" +import ( + "context" + "fmt" + "reflect" + + gofig "github.com/gookit/config/v2" +) // Log defines the available logging configuration. type Log struct { - Level string - Pretty bool - Color bool - File string + Level string `mapstructure:"level"` + Pretty bool `mapstructure:"pretty"` + Color bool `mapstructure:"color"` + File string `mapstructure:"file"` } // Debug defines the available debug configuration. type Debug struct { - Addr string - Token string - Pprof bool - Zpages bool + Addr string `mapstructure:"addr"` + Token string `mapstructure:"token"` + Pprof bool `mapstructure:"pprof"` + Zpages bool `mapstructure:"zpages"` } // HTTP defines the available http configuration. type HTTP struct { - Addr string - Namespace string - Root string + Addr string `mapstructure:"addr"` + Namespace string `mapstructure:"namespace"` + Root string `mapstructure:"root"` } // Server configures a server. type Server struct { - Version string - Name string + Version string `mapstructure:"version"` + Name string `mapstructure:"name"` } // Tracing defines the available tracing configuration. type Tracing struct { - Enabled bool - Type string - Endpoint string - Collector string - Service string + Enabled bool `mapstructure:"enabled"` + Type string `mapstructure:"type"` + Endpoint string `mapstructure:"endpoint"` + Collector string `mapstructure:"collector"` + Service string `mapstructure:"service"` } // Reva defines all available REVA configuration. type Reva struct { - Address string + Address string `mapstructure:"address"` } // TokenManager is the config for using the reva token manager type TokenManager struct { - JWTSecret string + JWTSecret string `mapstructure:"jwt_secret"` } type Spaces struct { - WebDavBase string - WebDavPath string - DefaultQuota string + WebDavBase string `mapstructure:"webdav_base"` + WebDavPath string `mapstructure:"webdav_path"` + DefaultQuota string `mapstructure:"default_quota"` } // Config combines all available configuration parts. type Config struct { - File string - Log Log - Debug Debug - HTTP HTTP - Server Server - Tracing Tracing - Reva Reva - TokenManager TokenManager - Spaces Spaces + File string `mapstructure:"file"` + Log Log `mapstructure:"log"` + Debug Debug `mapstructure:"debug"` + HTTP HTTP `mapstructure:"http"` + Server Server `mapstructure:"server"` + Tracing Tracing `mapstructure:"tracing"` + Reva Reva `mapstructure:"reva"` + TokenManager TokenManager `mapstructure:"token_manager"` + Spaces Spaces `mapstructure:"spaces"` Context context.Context Supervised bool @@ -76,3 +82,81 @@ type Config struct { func New() *Config { return &Config{} } + +func DefaultConfig() *Config { + return &Config{ + Log: Log{}, + Debug: Debug{ + Addr: "127.0.0.1:9124", + Token: "", + }, + HTTP: HTTP{ + Addr: "127.0.0.1:9120", + Namespace: "com.owncloud.web", + Root: "/graph", + }, + Server: Server{}, + Tracing: Tracing{ + Enabled: false, + Type: "jaeger", + Service: "graph", + }, + Reva: Reva{ + Address: "127.0.0.1:9142", + }, + TokenManager: TokenManager{ + JWTSecret: "Pive-Fumkiu4", + }, + Spaces: Spaces{ + WebDavBase: "https://localhost:9200", + WebDavPath: "/dav/spaces/", + DefaultQuota: "1000000000", + }, + } +} + +// GetEnv fetches a list of known env variables for this extension. It is to be used by gookit, as it provides a list +// with all the environment variables an extension supports. +func GetEnv() []string { + var r = make([]string, len(structMappings(&Config{}))) + for i := range structMappings(&Config{}) { + r = append(r, structMappings(&Config{})[i].EnvVars...) + } + + return r +} + +// UnmapEnv loads values from the gooconf.Config argument and sets them in the expected destination. +func (c *Config) UnmapEnv(gooconf *gofig.Config) error { + vals := structMappings(c) + for i := range vals { + for j := range vals[i].EnvVars { + // we need to guard against v != "" because this is the condition that checks that the value is set from the environment. + // the `ok` guard is not enough, apparently. + if v, ok := gooconf.GetValue(vals[i].EnvVars[j]); ok && v != "" { + + // get the destination type from destination + switch reflect.ValueOf(vals[i].Destination).Type().String() { + case "*bool": + r := gooconf.Bool(vals[i].EnvVars[j]) + *vals[i].Destination.(*bool) = r + case "*string": + r := gooconf.String(vals[i].EnvVars[j]) + *vals[i].Destination.(*string) = r + case "*int": + r := gooconf.Int(vals[i].EnvVars[j]) + *vals[i].Destination.(*int) = r + case "*float64": + // defaults to float64 + r := gooconf.Float(vals[i].EnvVars[j]) + *vals[i].Destination.(*float64) = r + default: + // it is unlikely we will ever get here. Let this serve more as a runtime check for when debugging. + return fmt.Errorf("invalid type for env var: `%v`", vals[i].EnvVars[j]) + } + } + } + } + + return nil +} diff --git a/graph/pkg/config/env.go b/graph/pkg/config/env.go new file mode 100644 index 000000000..2f22b33d2 --- /dev/null +++ b/graph/pkg/config/env.go @@ -0,0 +1,100 @@ +package config + +type mapping struct { + EnvVars []string // name of the EnvVars var. + Destination interface{} // memory address of the original config value to modify. +} + +// structMappings binds a set of environment variables to a destination on cfg. +func structMappings(cfg *Config) []mapping { + return []mapping{ + { + EnvVars: []string{"GRAPH_CONFIG_FILE"}, + Destination: &cfg.File, + }, + { + EnvVars: []string{"GRAPH_LOG_LEVEL", "OCIS_LOG_LEVEL"}, + Destination: &cfg.Log.Level, + }, + { + EnvVars: []string{"GRAPH_LOG_PRETTY", "OCIS_LOG_PRETTY"}, + Destination: &cfg.Log.Pretty, + }, + { + EnvVars: []string{"GRAPH_LOG_COLOR", "OCIS_LOG_COLOR"}, + Destination: &cfg.Log.Color, + }, + { + EnvVars: []string{"GRAPH_LOG_FILE", "OCIS_LOG_FILE"}, + Destination: &cfg.Log.File, + }, + { + EnvVars: []string{"GRAPH_TRACING_ENABLED", "OCIS_TRACING_ENABLED"}, + Destination: &cfg.Tracing.Enabled, + }, + { + EnvVars: []string{"GRAPH_TRACING_TYPE", "OCIS_TRACING_TYPE"}, + Destination: &cfg.Tracing.Type, + }, + { + EnvVars: []string{"GRAPH_TRACING_ENDPOINT", "OCIS_TRACING_ENDPOINT"}, + Destination: &cfg.Tracing.Endpoint, + }, + { + EnvVars: []string{"GRAPH_TRACING_COLLECTOR", "OCIS_TRACING_COLLECTOR"}, + Destination: &cfg.Tracing.Collector, + }, + { + EnvVars: []string{"GRAPH_TRACING_SERVICE"}, + Destination: &cfg.Tracing.Service, + }, + { + EnvVars: []string{"GRAPH_DEBUG_ADDR"}, + Destination: &cfg.Debug.Addr, + }, + { + EnvVars: []string{"GRAPH_DEBUG_TOKEN"}, + Destination: &cfg.Debug.Token, + }, + { + EnvVars: []string{"GRAPH_DEBUG_PPROF"}, + Destination: &cfg.Debug.Pprof, + }, + { + EnvVars: []string{"GRAPH_DEBUG_ZPAGES"}, + Destination: &cfg.Debug.Zpages, + }, + { + EnvVars: []string{"GRAPH_HTTP_ADDR"}, + Destination: &cfg.HTTP.Addr, + }, + { + EnvVars: []string{"GRAPH_HTTP_ROOT"}, + Destination: &cfg.HTTP.Root, + }, + { + EnvVars: []string{"GRAPH_HTTP_NAMESPACE"}, + Destination: &cfg.HTTP.Namespace, + }, + { + EnvVars: []string{"GRAPH_SPACES_WEBDAV_BASE", "OCIS_URL"}, + Destination: &cfg.Spaces.WebDavBase, + }, + { + EnvVars: []string{"GRAPH_SPACES_WEBDAV_PATH"}, + Destination: &cfg.Spaces.WebDavPath, + }, + { + EnvVars: []string{"GRAPH_SPACES_DEFAULT_QUOTA"}, + Destination: &cfg.Spaces.DefaultQuota, + }, + { + EnvVars: []string{"GRAPH_JWT_SECRET", "OCIS_JWT_SECRET"}, + Destination: &cfg.TokenManager.JWTSecret, + }, + { + EnvVars: []string{"REVA_GATEWAY"}, + Destination: &cfg.Reva.Address, + }, + } +}