diff --git a/accounts/pkg/config/config.go b/accounts/pkg/config/config.go index ff321826f8..78d76ba405 100644 --- a/accounts/pkg/config/config.go +++ b/accounts/pkg/config/config.go @@ -8,78 +8,78 @@ import ( // Config combines all available configuration parts. type Config struct { - *shared.Commons `yaml:"-"` + *shared.Commons - Service Service `yaml:"-"` + Service Service - Tracing *Tracing - Log *Log - Debug Debug + Tracing *Tracing `ocisConfig:"tracing"` + Log *Log `ocisConfig:"log"` + Debug Debug `ocisConfig:"debug"` - HTTP HTTP - GRPC GRPC + HTTP HTTP `ocisConfig:"http"` + GRPC GRPC `ocisConfig:"grpc"` - TokenManager TokenManager + TokenManager TokenManager `ocisConfig:"token_manager"` - Asset Asset - Repo Repo - Index Index - ServiceUser ServiceUser - HashDifficulty int `env:"ACCOUNTS_HASH_DIFFICULTY" desc:"The hash difficulty makes sure that validating a password takes at least a certain amount of time."` - DemoUsersAndGroups bool `env:"ACCOUNTS_DEMO_USERS_AND_GROUPS" desc:"If this flag is set the service will setup the demo users and groups."` + Asset Asset `ocisConfig:"asset"` + Repo Repo `ocisConfig:"repo"` + Index Index `ocisConfig:"index"` + ServiceUser ServiceUser `ocisConfig:"service_user"` + HashDifficulty int `ocisConfig:"hash_difficulty" env:"ACCOUNTS_HASH_DIFFICULTY" desc:"The hash difficulty makes sure that validating a password takes at least a certain amount of time."` + DemoUsersAndGroups bool `ocisConfig:"demo_users_and_groups" env:"ACCOUNTS_DEMO_USERS_AND_GROUPS" desc:"If this flag is set the service will setup the demo users and groups."` - Context context.Context `yaml:"-"` + Context context.Context } // Asset defines the available asset configuration. type Asset struct { - Path string `env:"ACCOUNTS_ASSET_PATH" desc:"The path to the ui assets."` + Path string `ocisConfig:"path" env:"ACCOUNTS_ASSET_PATH" desc:"The path to the ui assets."` } // TokenManager is the config for using the reva token manager type TokenManager struct { - JWTSecret string `env:"OCIS_JWT_SECRET;ACCOUNTS_JWT_SECRET" desc:"The secret to mint jwt tokens."` + JWTSecret string `ocisConfig:"jwt_secret" env:"OCIS_JWT_SECRET;ACCOUNTS_JWT_SECRET" desc:"The secret to mint jwt tokens."` } // Repo defines which storage implementation is to be used. type Repo struct { - Backend string `env:"ACCOUNTS_STORAGE_BACKEND" desc:"Defines which storage implementation is to be used"` + Backend string `ocisConfig:"backend" env:"ACCOUNTS_STORAGE_BACKEND" desc:"Defines which storage implementation is to be used"` Disk Disk CS3 CS3 } // Disk is the local disk implementation of the storage. type Disk struct { - Path string `env:"ACCOUNTS_STORAGE_DISK_PATH" desc:"The path where the accounts data is stored."` + Path string `ocisConfig:"path" env:"ACCOUNTS_STORAGE_DISK_PATH" desc:"The path where the accounts data is stored."` } // CS3 is the cs3 implementation of the storage. type CS3 struct { - ProviderAddr string `env:"ACCOUNTS_STORAGE_CS3_PROVIDER_ADDR" desc:"The address to the storage provider."` + ProviderAddr string `ocisConfig:"provider_addr" env:"ACCOUNTS_STORAGE_CS3_PROVIDER_ADDR" desc:"The address to the storage provider."` } // ServiceUser defines the user required for EOS. type ServiceUser struct { - UUID string `env:"ACCOUNTS_SERVICE_USER_UUID" desc:"The id of the accounts service user."` - Username string `env:"ACCOUNTS_SERVICE_USER_USERNAME" desc:"The username of the accounts service user."` - UID int64 `env:"ACCOUNTS_SERVICE_USER_UID" desc:"The uid of the accounts service user."` - GID int64 `env:"ACCOUNTS_SERVICE_USER_GID" desc:"The gid of the accounts service user."` + UUID string `ocisConfig:"uuid" env:"ACCOUNTS_SERVICE_USER_UUID" desc:"The id of the accounts service user."` + Username string `ocisConfig:"username" env:"ACCOUNTS_SERVICE_USER_USERNAME" desc:"The username of the accounts service user."` + UID int64 `ocisConfig:"uid" env:"ACCOUNTS_SERVICE_USER_UID" desc:"The uid of the accounts service user."` + GID int64 `ocisConfig:"gid" env:"ACCOUNTS_SERVICE_USER_GID" desc:"The gid of the accounts service user."` } // Index defines config for indexes. type Index struct { - UID UIDBound - GID GIDBound + UID UIDBound `ocisConfig:"uid"` + GID GIDBound `ocisConfig:"gid"` } // GIDBound defines a lower and upper bound. type GIDBound struct { - Lower int64 `env:"ACCOUNTS_GID_INDEX_LOWER_BOUND" desc:"The lowest possible gid value for the indexer."` - Upper int64 `env:"ACCOUNTS_GID_INDEX_UPPER_BOUND" desc:"The highest possible gid value for the indexer."` + Lower int64 `ocisConfig:"lower" env:"ACCOUNTS_GID_INDEX_LOWER_BOUND" desc:"The lowest possible gid value for the indexer."` + Upper int64 `ocisConfig:"upper" env:"ACCOUNTS_GID_INDEX_UPPER_BOUND" desc:"The highest possible gid value for the indexer."` } // UIDBound defines a lower and upper bound. type UIDBound struct { - Lower int64 `env:"ACCOUNTS_UID_INDEX_LOWER_BOUND" desc:"The lowest possible uid value for the indexer."` - Upper int64 `env:"ACCOUNTS_UID_INDEX_UPPER_BOUND" desc:"The highest possible uid value for the indexer."` + Lower int64 `ocisConfig:"lower" env:"ACCOUNTS_UID_INDEX_LOWER_BOUND" desc:"The lowest possible uid value for the indexer."` + Upper int64 `ocisConfig:"upper" env:"ACCOUNTS_UID_INDEX_UPPER_BOUND" desc:"The highest possible uid value for the indexer."` } diff --git a/accounts/pkg/config/debug.go b/accounts/pkg/config/debug.go index fd90aad7ab..539b8fabab 100644 --- a/accounts/pkg/config/debug.go +++ b/accounts/pkg/config/debug.go @@ -2,8 +2,8 @@ package config // Debug defines the available debug configuration. type Debug struct { - Addr string `env:"ACCOUNTS_DEBUG_ADDR"` - Token string `env:"ACCOUNTS_DEBUG_TOKEN"` - Pprof bool `env:"ACCOUNTS_DEBUG_PPROF"` - Zpages bool `env:"ACCOUNTS_DEBUG_ZPAGES"` + Addr string `ocisConfig:"addr" env:"ACCOUNTS_DEBUG_ADDR"` + Token string `ocisConfig:"token" env:"ACCOUNTS_DEBUG_TOKEN"` + Pprof bool `ocisConfig:"pprof" env:"ACCOUNTS_DEBUG_PPROF"` + Zpages bool `ocisConfig:"zpages" env:"ACCOUNTS_DEBUG_ZPAGES"` } diff --git a/accounts/pkg/config/grpc.go b/accounts/pkg/config/grpc.go index 29380f34f0..a89e0ca005 100644 --- a/accounts/pkg/config/grpc.go +++ b/accounts/pkg/config/grpc.go @@ -2,6 +2,6 @@ package config // GRPC defines the available grpc configuration. type GRPC struct { - Addr string `env:"ACCOUNTS_GRPC_ADDR" desc:"The address of the grpc service."` + Addr string `ocisConfig:"addr" env:"ACCOUNTS_GRPC_ADDR" desc:"The address of the grpc service."` Namespace string } diff --git a/accounts/pkg/config/http.go b/accounts/pkg/config/http.go index 3a59ea114f..81971eba11 100644 --- a/accounts/pkg/config/http.go +++ b/accounts/pkg/config/http.go @@ -2,10 +2,10 @@ package config // HTTP defines the available http configuration. type HTTP struct { - Addr string `env:"ACCOUNTS_HTTP_ADDR" desc:"The address of the http service."` + Addr string `ocisConfig:"addr" env:"ACCOUNTS_HTTP_ADDR" desc:"The address of the http service."` Namespace string - Root string `env:"ACCOUNTS_HTTP_ROOT" desc:"The root path of the http service."` - CacheTTL int `env:"ACCOUNTS_CACHE_TTL" desc:"The cache time for the static assets."` + Root string `ocisConfig:"root" env:"ACCOUNTS_HTTP_ROOT" desc:"The root path of the http service."` + CacheTTL int `ocisConfig:"cache_ttl" env:"ACCOUNTS_CACHE_TTL" desc:"The cache time for the static assets."` CORS CORS } diff --git a/accounts/pkg/config/log.go b/accounts/pkg/config/log.go index f4546fa608..f9548ed777 100644 --- a/accounts/pkg/config/log.go +++ b/accounts/pkg/config/log.go @@ -2,8 +2,8 @@ package config // Log defines the available log configuration. type Log struct { - Level string `env:"OCIS_LOG_LEVEL;ACCOUNTS_LOG_LEVEL" desc:"The log level."` - Pretty bool `env:"OCIS_LOG_PRETTY;ACCOUNTS_LOG_PRETTY" desc:"Activates pretty log output."` - Color bool `env:"OCIS_LOG_COLOR;ACCOUNTS_LOG_COLOR" desc:"Activates colorized log output."` - File string `env:"OCIS_LOG_FILE;ACCOUNTS_LOG_FILE" desc:"The target log file."` + Level string `ocisConfig:"level" env:"OCIS_LOG_LEVEL;ACCOUNTS_LOG_LEVEL" desc:"The log level."` + Pretty bool `ocisConfig:"pretty" env:"OCIS_LOG_PRETTY;ACCOUNTS_LOG_PRETTY" desc:"Activates pretty log output."` + Color bool `ocisConfig:"color" env:"OCIS_LOG_COLOR;ACCOUNTS_LOG_COLOR" desc:"Activates colorized log output."` + File string `ocisConfig:"file" env:"OCIS_LOG_FILE;ACCOUNTS_LOG_FILE" desc:"The target log file."` }