diff --git a/services/app-provider/pkg/config/config.go b/services/app-provider/pkg/config/config.go index c6f84da93..d77524228 100644 --- a/services/app-provider/pkg/config/config.go +++ b/services/app-provider/pkg/config/config.go @@ -16,7 +16,7 @@ type Config struct { GRPC GRPCConfig `yaml:"grpc"` TokenManager *TokenManager `yaml:"token_manager"` - Reva *Reva `yaml:"reva"` + Reva *shared.Reva `yaml:"reva"` ExternalAddr string `yaml:"external_addr" env:"APP_PROVIDER_EXTERNAL_ADDR" desc:"Address of the app provider, where the GATEWAY service can reach it."` Driver string `yaml:"driver" env:"APP_PROVIDER_DRIVER" desc:"Driver, the APP PROVIDER services uses. Only \"wopi\" is supported as of now."` diff --git a/services/app-provider/pkg/config/defaults/defaultconfig.go b/services/app-provider/pkg/config/defaults/defaultconfig.go index 2ba8a992e..8f045fe2c 100644 --- a/services/app-provider/pkg/config/defaults/defaultconfig.go +++ b/services/app-provider/pkg/config/defaults/defaultconfig.go @@ -28,7 +28,7 @@ func DefaultConfig() *config.Config { Service: config.Service{ Name: "app-provider", }, - Reva: &config.Reva{ + Reva: &shared.Reva{ Address: "127.0.0.1:9142", }, Driver: "", @@ -66,11 +66,11 @@ func EnsureDefaults(cfg *config.Config) { } if cfg.Reva == nil && cfg.Commons != nil && cfg.Commons.Reva != nil { - cfg.Reva = &config.Reva{ + cfg.Reva = &shared.Reva{ Address: cfg.Commons.Reva.Address, } } else if cfg.Reva == nil { - cfg.Reva = &config.Reva{} + cfg.Reva = &shared.Reva{} } if cfg.TokenManager == nil && cfg.Commons != nil && cfg.Commons.TokenManager != nil { diff --git a/services/app-provider/pkg/config/reva.go b/services/app-provider/pkg/config/reva.go index 135052cdc..9290c1ac4 100644 --- a/services/app-provider/pkg/config/reva.go +++ b/services/app-provider/pkg/config/reva.go @@ -1,10 +1,5 @@ package config -// Reva defines all available REVA configuration. -type Reva struct { - Address string `yaml:"address" env:"REVA_GATEWAY" desc:"The CS3 gateway endpoint."` -} - // TokenManager is the config for using the reva token manager type TokenManager struct { JWTSecret string `yaml:"jwt_secret" env:"OCIS_JWT_SECRET;APP_PROVIDER_JWT_SECRET" desc:"The secret to mint and validate jwt tokens."` diff --git a/services/app-registry/pkg/config/config.go b/services/app-registry/pkg/config/config.go index 817d0b91b..b095d5afb 100644 --- a/services/app-registry/pkg/config/config.go +++ b/services/app-registry/pkg/config/config.go @@ -17,7 +17,7 @@ type Config struct { GRPC GRPCConfig `yaml:"grpc"` TokenManager *TokenManager `yaml:"token_manager"` - Reva *Reva `yaml:"reva"` + Reva *shared.Reva `yaml:"reva"` AppRegistry AppRegistry `yaml:"app_registry"` diff --git a/services/app-registry/pkg/config/defaults/defaultconfig.go b/services/app-registry/pkg/config/defaults/defaultconfig.go index c754f4e50..3764bedf6 100644 --- a/services/app-registry/pkg/config/defaults/defaultconfig.go +++ b/services/app-registry/pkg/config/defaults/defaultconfig.go @@ -1,6 +1,7 @@ package defaults import ( + "github.com/owncloud/ocis/v2/ocis-pkg/shared" "github.com/owncloud/ocis/v2/services/app-registry/pkg/config" ) @@ -27,7 +28,7 @@ func DefaultConfig() *config.Config { Service: config.Service{ Name: "app-registry", }, - Reva: &config.Reva{ + Reva: &shared.Reva{ Address: "127.0.0.1:9142", }, } @@ -130,11 +131,11 @@ func EnsureDefaults(cfg *config.Config) { } if cfg.Reva == nil && cfg.Commons != nil && cfg.Commons.Reva != nil { - cfg.Reva = &config.Reva{ + cfg.Reva = &shared.Reva{ Address: cfg.Commons.Reva.Address, } } else if cfg.Reva == nil { - cfg.Reva = &config.Reva{} + cfg.Reva = &shared.Reva{} } if cfg.TokenManager == nil && cfg.Commons != nil && cfg.Commons.TokenManager != nil { diff --git a/services/app-registry/pkg/config/reva.go b/services/app-registry/pkg/config/reva.go index 13e56d8da..bc7eddf4f 100644 --- a/services/app-registry/pkg/config/reva.go +++ b/services/app-registry/pkg/config/reva.go @@ -1,10 +1,5 @@ package config -// Reva defines all available REVA configuration. -type Reva struct { - Address string `yaml:"address" env:"REVA_GATEWAY" desc:"The CS3 gateway endpoint."` -} - // TokenManager is the config for using the reva token manager type TokenManager struct { JWTSecret string `yaml:"jwt_secret" env:"OCIS_JWT_SECRET;APP_REGISTRY_JWT_SECRET" desc:"The secret to mint and validate jwt tokens."` diff --git a/services/auth-basic/pkg/config/config.go b/services/auth-basic/pkg/config/config.go index 1458ca107..b9352319a 100644 --- a/services/auth-basic/pkg/config/config.go +++ b/services/auth-basic/pkg/config/config.go @@ -16,7 +16,7 @@ type Config struct { GRPC GRPCConfig `yaml:"grpc"` TokenManager *TokenManager `yaml:"token_manager"` - Reva *Reva `yaml:"reva"` + Reva *shared.Reva `yaml:"reva"` SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token" env:"AUTH_BASIC_SKIP_USER_GROUPS_IN_TOKEN" desc:"Disables the encoding of the user's group memberships in the reva access token. This reduces the token size, especially when users are members of a large number of groups."` AuthProvider string `yaml:"auth_provider" env:"AUTH_BASIC_AUTH_PROVIDER" desc:"The auth provider which should be used by the service like 'ldap'."` diff --git a/services/auth-basic/pkg/config/defaults/defaultconfig.go b/services/auth-basic/pkg/config/defaults/defaultconfig.go index a84df115d..944872224 100644 --- a/services/auth-basic/pkg/config/defaults/defaultconfig.go +++ b/services/auth-basic/pkg/config/defaults/defaultconfig.go @@ -4,6 +4,7 @@ import ( "path/filepath" "github.com/owncloud/ocis/v2/ocis-pkg/config/defaults" + "github.com/owncloud/ocis/v2/ocis-pkg/shared" "github.com/owncloud/ocis/v2/services/auth-basic/pkg/config" ) @@ -30,7 +31,7 @@ func DefaultConfig() *config.Config { Service: config.Service{ Name: "auth-basic", }, - Reva: &config.Reva{ + Reva: &shared.Reva{ Address: "127.0.0.1:9142", }, AuthProvider: "ldap", @@ -104,11 +105,11 @@ func EnsureDefaults(cfg *config.Config) { } if cfg.Reva == nil && cfg.Commons != nil && cfg.Commons.Reva != nil { - cfg.Reva = &config.Reva{ + cfg.Reva = &shared.Reva{ Address: cfg.Commons.Reva.Address, } } else if cfg.Reva == nil { - cfg.Reva = &config.Reva{} + cfg.Reva = &shared.Reva{} } if cfg.TokenManager == nil && cfg.Commons != nil && cfg.Commons.TokenManager != nil { diff --git a/services/auth-basic/pkg/config/reva.go b/services/auth-basic/pkg/config/reva.go index 57793f4bc..6242d1caa 100644 --- a/services/auth-basic/pkg/config/reva.go +++ b/services/auth-basic/pkg/config/reva.go @@ -1,10 +1,5 @@ package config -// Reva defines all available REVA configuration. -type Reva struct { - Address string `yaml:"address" env:"REVA_GATEWAY" desc:"The CS3 gateway endpoint."` -} - // TokenManager is the config for using the reva token manager type TokenManager struct { JWTSecret string `yaml:"jwt_secret" env:"OCIS_JWT_SECRET;AUTH_BASIC_JWT_SECRET" desc:"The secret to mint and validate jwt tokens."` diff --git a/services/auth-bearer/pkg/config/config.go b/services/auth-bearer/pkg/config/config.go index 5503a2cef..03bd72869 100644 --- a/services/auth-bearer/pkg/config/config.go +++ b/services/auth-bearer/pkg/config/config.go @@ -16,7 +16,7 @@ type Config struct { GRPC GRPCConfig `yaml:"grpc"` TokenManager *TokenManager `yaml:"token_manager"` - Reva *Reva `yaml:"reva"` + Reva *shared.Reva `yaml:"reva"` SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token" env:"AUTH_BEARER_SKIP_USER_GROUPS_IN_TOKEN" desc:"Disables the encoding of the user's group memberships in the reva access token. This reduces the token size, especially when users are members of a large number of groups."` diff --git a/services/auth-bearer/pkg/config/defaults/defaultconfig.go b/services/auth-bearer/pkg/config/defaults/defaultconfig.go index 5b5aabdbd..9386f68a2 100644 --- a/services/auth-bearer/pkg/config/defaults/defaultconfig.go +++ b/services/auth-bearer/pkg/config/defaults/defaultconfig.go @@ -1,6 +1,7 @@ package defaults import ( + "github.com/owncloud/ocis/v2/ocis-pkg/shared" "github.com/owncloud/ocis/v2/services/auth-bearer/pkg/config" ) @@ -27,7 +28,7 @@ func DefaultConfig() *config.Config { Service: config.Service{ Name: "auth-bearer", }, - Reva: &config.Reva{ + Reva: &shared.Reva{ Address: "127.0.0.1:9142", }, OIDC: config.OIDC{ @@ -63,11 +64,11 @@ func EnsureDefaults(cfg *config.Config) { } if cfg.Reva == nil && cfg.Commons != nil && cfg.Commons.Reva != nil { - cfg.Reva = &config.Reva{ + cfg.Reva = &shared.Reva{ Address: cfg.Commons.Reva.Address, } } else if cfg.Reva == nil { - cfg.Reva = &config.Reva{} + cfg.Reva = &shared.Reva{} } if cfg.TokenManager == nil && cfg.Commons != nil && cfg.Commons.TokenManager != nil { diff --git a/services/auth-bearer/pkg/config/reva.go b/services/auth-bearer/pkg/config/reva.go index 5335b8a72..d556a0523 100644 --- a/services/auth-bearer/pkg/config/reva.go +++ b/services/auth-bearer/pkg/config/reva.go @@ -1,10 +1,5 @@ package config -// Reva defines all available REVA configuration. -type Reva struct { - Address string `yaml:"address" env:"REVA_GATEWAY" desc:"The CS3 gateway endpoint."` -} - // TokenManager is the config for using the reva token manager type TokenManager struct { JWTSecret string `yaml:"jwt_secret" env:"OCIS_JWT_SECRET;AUTH_BEARER_JWT_SECRET" desc:"The secret to mint and validate jwt tokens."` diff --git a/services/auth-machine/pkg/config/config.go b/services/auth-machine/pkg/config/config.go index d0b2c0b54..efdd2747f 100644 --- a/services/auth-machine/pkg/config/config.go +++ b/services/auth-machine/pkg/config/config.go @@ -16,7 +16,7 @@ type Config struct { GRPC GRPCConfig `yaml:"grpc"` TokenManager *TokenManager `yaml:"token_manager"` - Reva *Reva `yaml:"reva"` + Reva *shared.Reva `yaml:"reva"` SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token" env:"AUTH_MACHINE_SKIP_USER_GROUPS_IN_TOKEN" desc:"Disables the encoding of the user's group memberships in the reva access token. This reduces the token size, especially when users are members of a large number of groups."` diff --git a/services/auth-machine/pkg/config/defaults/defaultconfig.go b/services/auth-machine/pkg/config/defaults/defaultconfig.go index c861f8b38..d34a332cb 100644 --- a/services/auth-machine/pkg/config/defaults/defaultconfig.go +++ b/services/auth-machine/pkg/config/defaults/defaultconfig.go @@ -1,6 +1,7 @@ package defaults import ( + "github.com/owncloud/ocis/v2/ocis-pkg/shared" "github.com/owncloud/ocis/v2/services/auth-machine/pkg/config" ) @@ -27,7 +28,7 @@ func DefaultConfig() *config.Config { Service: config.Service{ Name: "auth-machine", }, - Reva: &config.Reva{ + Reva: &shared.Reva{ Address: "127.0.0.1:9142", }, } @@ -58,11 +59,11 @@ func EnsureDefaults(cfg *config.Config) { } if cfg.Reva == nil && cfg.Commons != nil && cfg.Commons.Reva != nil { - cfg.Reva = &config.Reva{ + cfg.Reva = &shared.Reva{ Address: cfg.Commons.Reva.Address, } } else if cfg.Reva == nil { - cfg.Reva = &config.Reva{} + cfg.Reva = &shared.Reva{} } if cfg.TokenManager == nil && cfg.Commons != nil && cfg.Commons.TokenManager != nil { diff --git a/services/auth-machine/pkg/config/reva.go b/services/auth-machine/pkg/config/reva.go index 099a5b3fe..14cb00d08 100644 --- a/services/auth-machine/pkg/config/reva.go +++ b/services/auth-machine/pkg/config/reva.go @@ -1,10 +1,5 @@ package config -// Reva defines all available REVA configuration. -type Reva struct { - Address string `yaml:"address" env:"REVA_GATEWAY" desc:"The CS3 gateway endpoint."` -} - // TokenManager is the config for using the reva token manager type TokenManager struct { JWTSecret string `yaml:"jwt_secret" env:"OCIS_JWT_SECRET;AUTH_MACHINE_JWT_SECRET" desc:"The secret to mint and validate jwt tokens."` diff --git a/services/frontend/pkg/config/config.go b/services/frontend/pkg/config/config.go index a3b92de91..2af685f4a 100644 --- a/services/frontend/pkg/config/config.go +++ b/services/frontend/pkg/config/config.go @@ -20,7 +20,7 @@ type Config struct { TransferSecret string `yaml:"transfer_secret" env:"STORAGE_TRANSFER_SECRET" desc:"Transfer secret for signing file up- and download requests."` TokenManager *TokenManager `yaml:"token_manager"` - Reva *Reva `yaml:"reva"` + Reva *shared.Reva `yaml:"reva"` MachineAuthAPIKey string `yaml:"machine_auth_api_key" env:"OCIS_MACHINE_AUTH_API_KEY;FRONTEND_MACHINE_AUTH_API_KEY" desc:"Machine auth API key used to validate internal requests necessary to access resources from other services."` SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token" env:"FRONTEND_SKIP_USER_GROUPS_IN_TOKEN" desc:"Disables the loading of user's group memberships from the reva access token."` diff --git a/services/frontend/pkg/config/defaults/defaultconfig.go b/services/frontend/pkg/config/defaults/defaultconfig.go index b70f8095c..6ff6341fc 100644 --- a/services/frontend/pkg/config/defaults/defaultconfig.go +++ b/services/frontend/pkg/config/defaults/defaultconfig.go @@ -1,6 +1,7 @@ package defaults import ( + "github.com/owncloud/ocis/v2/ocis-pkg/shared" "github.com/owncloud/ocis/v2/services/frontend/pkg/config" ) @@ -28,7 +29,7 @@ func DefaultConfig() *config.Config { Service: config.Service{ Name: "frontend", }, - Reva: &config.Reva{ + Reva: &shared.Reva{ Address: "127.0.0.1:9142", }, PublicURL: "https://localhost:9200", @@ -97,11 +98,11 @@ func EnsureDefaults(cfg *config.Config) { } if cfg.Reva == nil && cfg.Commons != nil && cfg.Commons.Reva != nil { - cfg.Reva = &config.Reva{ + cfg.Reva = &shared.Reva{ Address: cfg.Commons.Reva.Address, } } else if cfg.Reva == nil { - cfg.Reva = &config.Reva{} + cfg.Reva = &shared.Reva{} } if cfg.TokenManager == nil && cfg.Commons != nil && cfg.Commons.TokenManager != nil { diff --git a/services/frontend/pkg/config/reva.go b/services/frontend/pkg/config/reva.go index 8f0f7d14e..c24d8b808 100644 --- a/services/frontend/pkg/config/reva.go +++ b/services/frontend/pkg/config/reva.go @@ -1,10 +1,5 @@ package config -// Reva defines all available REVA configuration. -type Reva struct { - Address string `yaml:"address" env:"REVA_GATEWAY" desc:"The CS3 gateway endpoint."` -} - // TokenManager is the config for using the reva token manager type TokenManager struct { JWTSecret string `yaml:"jwt_secret" env:"OCIS_JWT_SECRET;FRONTEND_JWT_SECRET" desc:"The secret to mint and validate jwt tokens."` diff --git a/services/gateway/pkg/config/config.go b/services/gateway/pkg/config/config.go index 0114bb8c6..b0f4ce048 100644 --- a/services/gateway/pkg/config/config.go +++ b/services/gateway/pkg/config/config.go @@ -17,7 +17,7 @@ type Config struct { GRPC GRPCConfig `yaml:"grpc"` TokenManager *TokenManager `yaml:"token_manager"` - Reva *Reva `yaml:"reva"` + Reva *shared.Reva `yaml:"reva"` SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token" env:"GATEWAY_SKIP_USER_GROUPS_IN_TOKEN" desc:"Disables the loading of user's group memberships from the reva access token."` diff --git a/services/gateway/pkg/config/defaults/defaultconfig.go b/services/gateway/pkg/config/defaults/defaultconfig.go index 94b9b32ac..2681f8332 100644 --- a/services/gateway/pkg/config/defaults/defaultconfig.go +++ b/services/gateway/pkg/config/defaults/defaultconfig.go @@ -1,6 +1,7 @@ package defaults import ( + "github.com/owncloud/ocis/v2/ocis-pkg/shared" "github.com/owncloud/ocis/v2/services/gateway/pkg/config" ) @@ -27,7 +28,7 @@ func DefaultConfig() *config.Config { Service: config.Service{ Name: "gateway", }, - Reva: &config.Reva{ + Reva: &shared.Reva{ Address: "127.0.0.1:9142", }, @@ -88,11 +89,11 @@ func EnsureDefaults(cfg *config.Config) { } if cfg.Reva == nil && cfg.Commons != nil && cfg.Commons.Reva != nil { - cfg.Reva = &config.Reva{ + cfg.Reva = &shared.Reva{ Address: cfg.Commons.Reva.Address, } } else if cfg.Reva == nil { - cfg.Reva = &config.Reva{} + cfg.Reva = &shared.Reva{} } if cfg.TokenManager == nil && cfg.Commons != nil && cfg.Commons.TokenManager != nil { diff --git a/services/gateway/pkg/config/reva.go b/services/gateway/pkg/config/reva.go index b781f8c32..957e54590 100644 --- a/services/gateway/pkg/config/reva.go +++ b/services/gateway/pkg/config/reva.go @@ -1,10 +1,5 @@ package config -// Reva defines all available REVA configuration. -type Reva struct { - Address string `yaml:"address" env:"REVA_GATEWAY" desc:"The CS3 gateway endpoint."` -} - // TokenManager is the config for using the reva token manager type TokenManager struct { JWTSecret string `yaml:"jwt_secret" env:"OCIS_JWT_SECRET;GATEWAY_JWT_SECRET" desc:"The secret to mint and validate jwt tokens."` diff --git a/services/graph/pkg/config/config.go b/services/graph/pkg/config/config.go index 7caa0b643..a4f19e115 100644 --- a/services/graph/pkg/config/config.go +++ b/services/graph/pkg/config/config.go @@ -19,7 +19,7 @@ type Config struct { HTTP HTTP `yaml:"http"` - Reva *Reva `yaml:"reva"` + Reva *shared.Reva `yaml:"reva"` TokenManager *TokenManager `yaml:"token_manager"` Spaces Spaces `yaml:"spaces"` diff --git a/services/graph/pkg/config/defaults/defaultconfig.go b/services/graph/pkg/config/defaults/defaultconfig.go index 34d05c2b0..0739d218a 100644 --- a/services/graph/pkg/config/defaults/defaultconfig.go +++ b/services/graph/pkg/config/defaults/defaultconfig.go @@ -5,6 +5,7 @@ import ( "strings" "github.com/owncloud/ocis/v2/ocis-pkg/config/defaults" + "github.com/owncloud/ocis/v2/ocis-pkg/shared" "github.com/owncloud/ocis/v2/services/graph/pkg/config" ) @@ -29,7 +30,7 @@ func DefaultConfig() *config.Config { Service: config.Service{ Name: "graph", }, - Reva: &config.Reva{ + Reva: &shared.Reva{ Address: "127.0.0.1:9142", }, Spaces: config.Spaces{ diff --git a/services/graph/pkg/config/reva.go b/services/graph/pkg/config/reva.go index 4bacfc576..e9314b7fc 100644 --- a/services/graph/pkg/config/reva.go +++ b/services/graph/pkg/config/reva.go @@ -1,10 +1,5 @@ package config -// Reva defines all available REVA configuration. -type Reva struct { - Address string `yaml:"address" env:"REVA_GATEWAY" desc:"The CS3 gateway endpoint."` -} - // TokenManager is the config for using the reva token manager type TokenManager struct { JWTSecret string `yaml:"jwt_secret" env:"OCIS_JWT_SECRET;GRAPH_JWT_SECRET" desc:"The secret to mint and validate jwt tokens."` diff --git a/services/graph/pkg/identity/cs3.go b/services/graph/pkg/identity/cs3.go index 015de1191..af1496e0f 100644 --- a/services/graph/pkg/identity/cs3.go +++ b/services/graph/pkg/identity/cs3.go @@ -11,7 +11,7 @@ import ( libregraph "github.com/owncloud/libre-graph-api-go" "github.com/owncloud/ocis/v2/ocis-pkg/log" - "github.com/owncloud/ocis/v2/services/graph/pkg/config" + "github.com/owncloud/ocis/v2/ocis-pkg/shared" "github.com/owncloud/ocis/v2/services/graph/pkg/service/v0/errorcode" ) @@ -20,7 +20,7 @@ var ( ) type CS3 struct { - Config *config.Reva + Config *shared.Reva Logger *log.Logger } diff --git a/services/groups/pkg/config/config.go b/services/groups/pkg/config/config.go index fb8e9ed13..56760e67f 100644 --- a/services/groups/pkg/config/config.go +++ b/services/groups/pkg/config/config.go @@ -16,7 +16,7 @@ type Config struct { GRPC GRPCConfig `yaml:"grpc"` TokenManager *TokenManager `yaml:"token_manager"` - Reva *Reva `yaml:"reva"` + Reva *shared.Reva `yaml:"reva"` SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token" env:"GROUPS_SKIP_USER_GROUPS_IN_TOKEN" desc:"Disables the loading of user's group memberships from the reva access token."` diff --git a/services/groups/pkg/config/defaults/defaultconfig.go b/services/groups/pkg/config/defaults/defaultconfig.go index 822efa66d..351d4f888 100644 --- a/services/groups/pkg/config/defaults/defaultconfig.go +++ b/services/groups/pkg/config/defaults/defaultconfig.go @@ -4,6 +4,7 @@ import ( "path/filepath" "github.com/owncloud/ocis/v2/ocis-pkg/config/defaults" + "github.com/owncloud/ocis/v2/ocis-pkg/shared" "github.com/owncloud/ocis/v2/services/groups/pkg/config" ) @@ -30,7 +31,7 @@ func DefaultConfig() *config.Config { Service: config.Service{ Name: "groups", }, - Reva: &config.Reva{ + Reva: &shared.Reva{ Address: "127.0.0.1:9142", }, Driver: "ldap", @@ -105,11 +106,11 @@ func EnsureDefaults(cfg *config.Config) { } if cfg.Reva == nil && cfg.Commons != nil && cfg.Commons.Reva != nil { - cfg.Reva = &config.Reva{ + cfg.Reva = &shared.Reva{ Address: cfg.Commons.Reva.Address, } } else if cfg.Reva == nil { - cfg.Reva = &config.Reva{} + cfg.Reva = &shared.Reva{} } if cfg.TokenManager == nil && cfg.Commons != nil && cfg.Commons.TokenManager != nil { diff --git a/services/groups/pkg/config/reva.go b/services/groups/pkg/config/reva.go index 82239b44c..ff28fdecf 100644 --- a/services/groups/pkg/config/reva.go +++ b/services/groups/pkg/config/reva.go @@ -1,10 +1,5 @@ package config -// Reva defines all available REVA configuration. -type Reva struct { - Address string `yaml:"address" env:"REVA_GATEWAY" desc:"The CS3 gateway endpoint."` -} - // TokenManager is the config for using the reva token manager type TokenManager struct { JWTSecret string `yaml:"jwt_secret" env:"OCIS_JWT_SECRET;GROUPS_JWT_SECRET" desc:"The secret to mint and validate jwt tokens."` diff --git a/services/idp/pkg/config/config.go b/services/idp/pkg/config/config.go index 385ff180d..515b6970c 100644 --- a/services/idp/pkg/config/config.go +++ b/services/idp/pkg/config/config.go @@ -18,7 +18,7 @@ type Config struct { HTTP HTTP `yaml:"http"` - Reva *Reva `yaml:"reva"` + Reva *shared.Reva `yaml:"reva"` MachineAuthAPIKey string `yaml:"machine_auth_api_key" env:"OCIS_MACHINE_AUTH_API_KEY;IDP_MACHINE_AUTH_API_KEY" desc:"Machine auth API key used to validate internal requests necessary for the access to resources from other services."` diff --git a/services/idp/pkg/config/defaults/defaultconfig.go b/services/idp/pkg/config/defaults/defaultconfig.go index 507654495..0bff438f4 100644 --- a/services/idp/pkg/config/defaults/defaultconfig.go +++ b/services/idp/pkg/config/defaults/defaultconfig.go @@ -5,6 +5,7 @@ import ( "strings" "github.com/owncloud/ocis/v2/ocis-pkg/config/defaults" + "github.com/owncloud/ocis/v2/ocis-pkg/shared" "github.com/owncloud/ocis/v2/services/idp/pkg/config" ) @@ -28,7 +29,7 @@ func DefaultConfig() *config.Config { TLSKey: filepath.Join(defaults.BaseDataPath(), "idp", "server.key"), TLS: false, }, - Reva: &config.Reva{ + Reva: &shared.Reva{ Address: "127.0.0.1:9142", }, Service: config.Service{ @@ -153,11 +154,11 @@ func EnsureDefaults(cfg *config.Config) { } if cfg.Reva == nil && cfg.Commons != nil && cfg.Commons.Reva != nil { - cfg.Reva = &config.Reva{ + cfg.Reva = &shared.Reva{ Address: cfg.Commons.Reva.Address, } } else if cfg.Reva == nil { - cfg.Reva = &config.Reva{} + cfg.Reva = &shared.Reva{} } if cfg.MachineAuthAPIKey == "" && cfg.Commons != nil && cfg.Commons.MachineAuthAPIKey != "" { diff --git a/services/idp/pkg/config/reva.go b/services/idp/pkg/config/reva.go deleted file mode 100644 index 5b4222251..000000000 --- a/services/idp/pkg/config/reva.go +++ /dev/null @@ -1,6 +0,0 @@ -package config - -// Reva defines all available REVA configuration. -type Reva struct { - Address string `yaml:"address" env:"REVA_GATEWAY" desc:"CS3 gateway used to authenticate and look up users"` -} diff --git a/services/notifications/pkg/channels/channels.go b/services/notifications/pkg/channels/channels.go index 59928fbc2..c1a018e6d 100644 --- a/services/notifications/pkg/channels/channels.go +++ b/services/notifications/pkg/channels/channels.go @@ -27,7 +27,7 @@ type Channel interface { // NewMailChannel instantiates a new mail communication channel. func NewMailChannel(cfg config.Config, logger log.Logger) (Channel, error) { - gc, err := pool.GetGatewayServiceClient(cfg.Notifications.RevaGateway) + gc, err := pool.GetGatewayServiceClient(cfg.Notifications.Reva.Address) if err != nil { logger.Error().Err(err).Msg("could not get gateway client") return nil, err diff --git a/services/notifications/pkg/command/server.go b/services/notifications/pkg/command/server.go index c27787ac3..c2448efe8 100644 --- a/services/notifications/pkg/command/server.go +++ b/services/notifications/pkg/command/server.go @@ -77,9 +77,9 @@ func Server(cfg *config.Config) *cli.Command { if err != nil { return err } - gwclient, err := pool.GetGatewayServiceClient(cfg.Notifications.RevaGateway) + gwclient, err := pool.GetGatewayServiceClient(cfg.Notifications.Reva.Address) if err != nil { - logger.Fatal().Err(err).Str("addr", cfg.Notifications.RevaGateway).Msg("could not get reva client") + logger.Fatal().Err(err).Str("addr", cfg.Notifications.Reva.Address).Msg("could not get reva client") } svc := service.NewEventsNotifier(evts, channel, logger, gwclient, cfg.Notifications.MachineAuthAPIKey, cfg.Notifications.EmailTemplatePath, cfg.Commons.OcisURL) diff --git a/services/notifications/pkg/config/config.go b/services/notifications/pkg/config/config.go index fae9ec89e..652dc32dd 100644 --- a/services/notifications/pkg/config/config.go +++ b/services/notifications/pkg/config/config.go @@ -22,11 +22,11 @@ type Config struct { // Notifications defines the config options for the notifications service. type Notifications struct { - SMTP SMTP `yaml:"SMTP"` - Events Events `yaml:"events"` - RevaGateway string `yaml:"reva_gateway" env:"REVA_GATEWAY;NOTIFICATIONS_REVA_GATEWAY" desc:"CS3 gateway used to look up user metadata"` - MachineAuthAPIKey string `yaml:"machine_auth_api_key" env:"OCIS_MACHINE_AUTH_API_KEY;NOTIFICATIONS_MACHINE_AUTH_API_KEY" desc:"Machine auth API key used to validate internal requests necessary to access resources from other services."` - EmailTemplatePath string `yaml:"email_template_path" env:"OCIS_EMAIL_TEMPLATE_PATH;NOTIFICATIONS_EMAIL_TEMPLATE_PATH" desc:"Path to Email notification templates overriding embedded ones."` + SMTP SMTP `yaml:"SMTP"` + Events Events `yaml:"events"` + MachineAuthAPIKey string `yaml:"machine_auth_api_key" env:"OCIS_MACHINE_AUTH_API_KEY;NOTIFICATIONS_MACHINE_AUTH_API_KEY" desc:"Machine auth API key used to validate internal requests necessary to access resources from other services."` + Reva shared.Reva `yaml:"reva"` + EmailTemplatePath string `yaml:"email_template_path" env:"OCIS_EMAIL_TEMPLATE_PATH;NOTIFICATIONS_EMAIL_TEMPLATE_PATH" desc:"Path to Email notification templates overriding embedded ones."` } // SMTP combines the smtp configuration options. diff --git a/services/notifications/pkg/config/defaults/defaultconfig.go b/services/notifications/pkg/config/defaults/defaultconfig.go index 53f8faa1d..5d7d9fdd7 100644 --- a/services/notifications/pkg/config/defaults/defaultconfig.go +++ b/services/notifications/pkg/config/defaults/defaultconfig.go @@ -1,6 +1,7 @@ package defaults import ( + "github.com/owncloud/ocis/v2/ocis-pkg/shared" "github.com/owncloud/ocis/v2/services/notifications/pkg/config" ) @@ -36,7 +37,9 @@ func DefaultConfig() *config.Config { ConsumerGroup: "notifications", EnableTLS: false, }, - RevaGateway: "127.0.0.1:9142", + Reva: shared.Reva{ + Address: "127.0.0.1:9142", + }, }, } } diff --git a/services/ocdav/pkg/config/config.go b/services/ocdav/pkg/config/config.go index 3ed98bf3e..9f2d3f12f 100644 --- a/services/ocdav/pkg/config/config.go +++ b/services/ocdav/pkg/config/config.go @@ -16,7 +16,7 @@ type Config struct { HTTP HTTPConfig `yaml:"http"` TokenManager *TokenManager `yaml:"token_manager"` - Reva *Reva `yaml:"reva"` + Reva *shared.Reva `yaml:"reva"` SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token" env:"OCDAV_SKIP_USER_GROUPS_IN_TOKEN" desc:"Disables the loading of user's group memberships from the reva access token."` diff --git a/services/ocdav/pkg/config/defaults/defaultconfig.go b/services/ocdav/pkg/config/defaults/defaultconfig.go index 23d2c9561..11051c346 100644 --- a/services/ocdav/pkg/config/defaults/defaultconfig.go +++ b/services/ocdav/pkg/config/defaults/defaultconfig.go @@ -1,6 +1,7 @@ package defaults import ( + "github.com/owncloud/ocis/v2/ocis-pkg/shared" "github.com/owncloud/ocis/v2/ocis-pkg/version" "github.com/owncloud/ocis/v2/services/ocdav/pkg/config" ) @@ -29,7 +30,7 @@ func DefaultConfig() *config.Config { Service: config.Service{ Name: "ocdav", }, - Reva: &config.Reva{ + Reva: &shared.Reva{ Address: "127.0.0.1:9142", }, WebdavNamespace: "/users/{{.Id.OpaqueId}}", @@ -80,11 +81,11 @@ func EnsureDefaults(cfg *config.Config) { } if cfg.Reva == nil && cfg.Commons != nil && cfg.Commons.Reva != nil { - cfg.Reva = &config.Reva{ + cfg.Reva = &shared.Reva{ Address: cfg.Commons.Reva.Address, } } else if cfg.Reva == nil { - cfg.Reva = &config.Reva{} + cfg.Reva = &shared.Reva{} } if cfg.TokenManager == nil && cfg.Commons != nil && cfg.Commons.TokenManager != nil { diff --git a/services/ocdav/pkg/config/reva.go b/services/ocdav/pkg/config/reva.go index 60374747e..6c772dafa 100644 --- a/services/ocdav/pkg/config/reva.go +++ b/services/ocdav/pkg/config/reva.go @@ -1,10 +1,5 @@ package config -// Reva defines all available REVA configuration. -type Reva struct { - Address string `yaml:"address" env:"REVA_GATEWAY" desc:"The CS3 gateway endpoint."` -} - // TokenManager is the config for using the reva token manager type TokenManager struct { JWTSecret string `yaml:"jwt_secret" env:"OCIS_JWT_SECRET;OCDAV_JWT_SECRET" desc:"The secret to mint and validate jwt tokens."` diff --git a/services/ocs/pkg/config/config.go b/services/ocs/pkg/config/config.go index 9729fa19d..4653d5168 100644 --- a/services/ocs/pkg/config/config.go +++ b/services/ocs/pkg/config/config.go @@ -20,7 +20,7 @@ type Config struct { HTTP HTTP `yaml:"http"` TokenManager *TokenManager `yaml:"token_manager"` - Reva *Reva `yaml:"reva"` + Reva *shared.Reva `yaml:"reva"` IdentityManagement IdentityManagement `yaml:"identity_management"` diff --git a/services/ocs/pkg/config/defaults/defaultconfig.go b/services/ocs/pkg/config/defaults/defaultconfig.go index 7e9c03ea9..97ddd3394 100644 --- a/services/ocs/pkg/config/defaults/defaultconfig.go +++ b/services/ocs/pkg/config/defaults/defaultconfig.go @@ -3,6 +3,7 @@ package defaults import ( "strings" + "github.com/owncloud/ocis/v2/ocis-pkg/shared" "github.com/owncloud/ocis/v2/services/ocs/pkg/config" ) @@ -36,7 +37,7 @@ func DefaultConfig() *config.Config { Name: "ocs", }, AccountBackend: "cs3", - Reva: &config.Reva{ + Reva: &shared.Reva{ Address: "127.0.0.1:9142", }, IdentityManagement: config.IdentityManagement{ @@ -80,11 +81,11 @@ func EnsureDefaults(cfg *config.Config) { } if cfg.Reva == nil && cfg.Commons != nil && cfg.Commons.Reva != nil { - cfg.Reva = &config.Reva{ + cfg.Reva = &shared.Reva{ Address: cfg.Commons.Reva.Address, } } else if cfg.Reva == nil { - cfg.Reva = &config.Reva{} + cfg.Reva = &shared.Reva{} } if cfg.TokenManager == nil && cfg.Commons != nil && cfg.Commons.TokenManager != nil { diff --git a/services/ocs/pkg/config/reva.go b/services/ocs/pkg/config/reva.go index d4f77cdc5..149233e36 100644 --- a/services/ocs/pkg/config/reva.go +++ b/services/ocs/pkg/config/reva.go @@ -1,10 +1,5 @@ package config -// Reva defines all available REVA configuration. -type Reva struct { - Address string `yaml:"address" env:"REVA_GATEWAY" desc:"The CS3 gateway endpoint."` -} - // TokenManager is the config for using the reva token manager type TokenManager struct { JWTSecret string `yaml:"jwt_secret" env:"OCIS_JWT_SECRET;OCS_JWT_SECRET" desc:"The secret to mint and validate jwt tokens."` diff --git a/services/proxy/pkg/config/config.go b/services/proxy/pkg/config/config.go index 886351589..c2b2236af 100644 --- a/services/proxy/pkg/config/config.go +++ b/services/proxy/pkg/config/config.go @@ -18,7 +18,7 @@ type Config struct { HTTP HTTP `yaml:"http"` - Reva *Reva `yaml:"reva"` + Reva *shared.Reva `yaml:"reva"` Policies []Policy `yaml:"policies"` OIDC OIDC `yaml:"oidc"` diff --git a/services/proxy/pkg/config/defaults/defaultconfig.go b/services/proxy/pkg/config/defaults/defaultconfig.go index 06b5878c1..cd40c61f9 100644 --- a/services/proxy/pkg/config/defaults/defaultconfig.go +++ b/services/proxy/pkg/config/defaults/defaultconfig.go @@ -5,6 +5,7 @@ import ( "strings" "github.com/owncloud/ocis/v2/ocis-pkg/config/defaults" + "github.com/owncloud/ocis/v2/ocis-pkg/shared" "github.com/owncloud/ocis/v2/services/proxy/pkg/config" ) @@ -48,7 +49,7 @@ func DefaultConfig() *config.Config { }, }, PolicySelector: nil, - Reva: &config.Reva{ + Reva: &shared.Reva{ Address: "127.0.0.1:9142", }, PreSignedURL: config.PreSignedURL{ @@ -242,11 +243,11 @@ func EnsureDefaults(cfg *config.Config) { } if cfg.Reva == nil && cfg.Commons != nil && cfg.Commons.Reva != nil { - cfg.Reva = &config.Reva{ + cfg.Reva = &shared.Reva{ Address: cfg.Commons.Reva.Address, } } else if cfg.Reva == nil { - cfg.Reva = &config.Reva{} + cfg.Reva = &shared.Reva{} } } diff --git a/services/proxy/pkg/config/reva.go b/services/proxy/pkg/config/reva.go deleted file mode 100644 index c84988f53..000000000 --- a/services/proxy/pkg/config/reva.go +++ /dev/null @@ -1,6 +0,0 @@ -package config - -// Reva defines all available REVA configuration. -type Reva struct { - Address string `yaml:"address" env:"REVA_GATEWAY" desc:"The CS3 gateway endpoint."` -} diff --git a/services/search/pkg/config/config.go b/services/search/pkg/config/config.go index 5e4eed934..b69832cd3 100644 --- a/services/search/pkg/config/config.go +++ b/services/search/pkg/config/config.go @@ -18,9 +18,9 @@ type Config struct { GRPC GRPC `yaml:"grpc"` - Datapath string `yaml:"data_path" env:"SEARCH_DATA_PATH" desc:"The directory where the filesystem storage will store search data. If not definied, the root directory derives from $OCIS_BASE_DATA_PATH:/search."` - Reva *Reva `yaml:"reva"` - Events Events `yaml:"events"` + Datapath string `yaml:"data_path" env:"SEARCH_DATA_PATH" desc:"The directory where the filesystem storage will store search data. If not definied, the root directory derives from $OCIS_BASE_DATA_PATH:/search."` + Reva *shared.Reva `yaml:"reva"` + Events Events `yaml:"events"` MachineAuthAPIKey string `yaml:"machine_auth_api_key" env:"OCIS_MACHINE_AUTH_API_KEY;SEARCH_MACHINE_AUTH_API_KEY" desc:"Machine auth API key used to validate internal requests necessary for the access to resources from other services."` diff --git a/services/search/pkg/config/defaults/defaultconfig.go b/services/search/pkg/config/defaults/defaultconfig.go index e3b2a5535..495f8ec2b 100644 --- a/services/search/pkg/config/defaults/defaultconfig.go +++ b/services/search/pkg/config/defaults/defaultconfig.go @@ -4,6 +4,7 @@ import ( "path" "github.com/owncloud/ocis/v2/ocis-pkg/config/defaults" + "github.com/owncloud/ocis/v2/ocis-pkg/shared" "github.com/owncloud/ocis/v2/services/search/pkg/config" ) @@ -29,7 +30,7 @@ func DefaultConfig() *config.Config { Name: "search", }, Datapath: path.Join(defaults.BaseDataPath(), "search"), - Reva: &config.Reva{ + Reva: &shared.Reva{ Address: "127.0.0.1:9142", }, Events: config.Events{ @@ -72,11 +73,11 @@ func EnsureDefaults(cfg *config.Config) { } if cfg.Reva == nil && cfg.Commons != nil && cfg.Commons.Reva != nil { - cfg.Reva = &config.Reva{ + cfg.Reva = &shared.Reva{ Address: cfg.Commons.Reva.Address, } } else if cfg.Reva == nil { - cfg.Reva = &config.Reva{} + cfg.Reva = &shared.Reva{} } } diff --git a/services/search/pkg/config/reva.go b/services/search/pkg/config/reva.go deleted file mode 100644 index f0c218ad8..000000000 --- a/services/search/pkg/config/reva.go +++ /dev/null @@ -1,6 +0,0 @@ -package config - -// Reva defines all available REVA configuration. -type Reva struct { - Address string `ocisConfig:"address" env:"REVA_GATEWAY" desc:"The CS3 gateway endpoint."` -} diff --git a/services/sharing/pkg/config/config.go b/services/sharing/pkg/config/config.go index b9b2714f5..9d35a5221 100644 --- a/services/sharing/pkg/config/config.go +++ b/services/sharing/pkg/config/config.go @@ -16,7 +16,7 @@ type Config struct { GRPC GRPCConfig `yaml:"grpc"` TokenManager *TokenManager `yaml:"token_manager"` - Reva *Reva `yaml:"reva"` + Reva *shared.Reva `yaml:"reva"` Events Events `yaml:"events"` SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token" env:"SHARING_SKIP_USER_GROUPS_IN_TOKEN" desc:"Disables the loading of user's group memberships from the reva access token."` diff --git a/services/sharing/pkg/config/defaults/defaultconfig.go b/services/sharing/pkg/config/defaults/defaultconfig.go index d404b874d..5368f0337 100644 --- a/services/sharing/pkg/config/defaults/defaultconfig.go +++ b/services/sharing/pkg/config/defaults/defaultconfig.go @@ -4,6 +4,7 @@ import ( "path/filepath" "github.com/owncloud/ocis/v2/ocis-pkg/config/defaults" + "github.com/owncloud/ocis/v2/ocis-pkg/shared" "github.com/owncloud/ocis/v2/services/sharing/pkg/config" ) @@ -30,7 +31,7 @@ func DefaultConfig() *config.Config { Service: config.Service{ Name: "sharing", }, - Reva: &config.Reva{ + Reva: &shared.Reva{ Address: "127.0.0.1:9142", }, UserSharingDriver: "jsoncs3", @@ -101,11 +102,11 @@ func EnsureDefaults(cfg *config.Config) { } if cfg.Reva == nil && cfg.Commons != nil && cfg.Commons.Reva != nil { - cfg.Reva = &config.Reva{ + cfg.Reva = &shared.Reva{ Address: cfg.Commons.Reva.Address, } } else if cfg.Reva == nil { - cfg.Reva = &config.Reva{} + cfg.Reva = &shared.Reva{} } if cfg.TokenManager == nil && cfg.Commons != nil && cfg.Commons.TokenManager != nil { diff --git a/services/sharing/pkg/config/reva.go b/services/sharing/pkg/config/reva.go index 85b7124dd..2f0576e05 100644 --- a/services/sharing/pkg/config/reva.go +++ b/services/sharing/pkg/config/reva.go @@ -1,10 +1,5 @@ package config -// Reva defines all available REVA configuration. -type Reva struct { - Address string `yaml:"address" env:"REVA_GATEWAY" desc:"The CS3 gateway endpoint."` -} - // TokenManager is the config for using the reva token manager type TokenManager struct { JWTSecret string `yaml:"jwt_secret" env:"OCIS_JWT_SECRET;SHARING_JWT_SECRET" desc:"The secret to mint and validate jwt tokens."` diff --git a/services/storage-publiclink/pkg/config/config.go b/services/storage-publiclink/pkg/config/config.go index c2569e519..311328f41 100644 --- a/services/storage-publiclink/pkg/config/config.go +++ b/services/storage-publiclink/pkg/config/config.go @@ -16,7 +16,7 @@ type Config struct { GRPC GRPCConfig `yaml:"grpc"` TokenManager *TokenManager `yaml:"token_manager"` - Reva *Reva `yaml:"reva"` + Reva *shared.Reva `yaml:"reva"` SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token" env:"STORAGE_PUBLICLINK_SKIP_USER_GROUPS_IN_TOKEN" desc:"Disables the loading of user's group memberships from the reva access token."` diff --git a/services/storage-publiclink/pkg/config/defaults/defaultconfig.go b/services/storage-publiclink/pkg/config/defaults/defaultconfig.go index 9d8670eba..229f3c19b 100644 --- a/services/storage-publiclink/pkg/config/defaults/defaultconfig.go +++ b/services/storage-publiclink/pkg/config/defaults/defaultconfig.go @@ -1,6 +1,7 @@ package defaults import ( + "github.com/owncloud/ocis/v2/ocis-pkg/shared" "github.com/owncloud/ocis/v2/services/storage-publiclink/pkg/config" ) @@ -27,7 +28,7 @@ func DefaultConfig() *config.Config { Service: config.Service{ Name: "storage-publiclink", }, - Reva: &config.Reva{ + Reva: &shared.Reva{ Address: "127.0.0.1:9142", }, StorageProvider: config.StorageProvider{ @@ -61,11 +62,11 @@ func EnsureDefaults(cfg *config.Config) { } if cfg.Reva == nil && cfg.Commons != nil && cfg.Commons.Reva != nil { - cfg.Reva = &config.Reva{ + cfg.Reva = &shared.Reva{ Address: cfg.Commons.Reva.Address, } } else if cfg.Reva == nil { - cfg.Reva = &config.Reva{} + cfg.Reva = &shared.Reva{} } if cfg.TokenManager == nil && cfg.Commons != nil && cfg.Commons.TokenManager != nil { diff --git a/services/storage-publiclink/pkg/config/reva.go b/services/storage-publiclink/pkg/config/reva.go index 06102c99d..bc92edbfa 100644 --- a/services/storage-publiclink/pkg/config/reva.go +++ b/services/storage-publiclink/pkg/config/reva.go @@ -1,10 +1,5 @@ package config -// Reva defines all available REVA configuration. -type Reva struct { - Address string `yaml:"address" env:"REVA_GATEWAY" desc:"The CS3 gateway endpoint."` -} - // TokenManager is the config for using the reva token manager type TokenManager struct { JWTSecret string `yaml:"jwt_secret" env:"OCIS_JWT_SECRET;STORAGE_PUBLICLINK_JWT_SECRET" desc:"The secret to mint and validate jwt tokens."` diff --git a/services/storage-shares/pkg/config/config.go b/services/storage-shares/pkg/config/config.go index 33a46d2ec..8cacec592 100644 --- a/services/storage-shares/pkg/config/config.go +++ b/services/storage-shares/pkg/config/config.go @@ -16,7 +16,7 @@ type Config struct { GRPC GRPCConfig `yaml:"grpc"` TokenManager *TokenManager `yaml:"token_manager"` - Reva *Reva `yaml:"reva"` + Reva *shared.Reva `yaml:"reva"` SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token" env:"STORAGE_SHARES_SKIP_USER_GROUPS_IN_TOKEN" desc:"Disables the loading of user's group memberships from the reva access token."` diff --git a/services/storage-shares/pkg/config/defaults/defaultconfig.go b/services/storage-shares/pkg/config/defaults/defaultconfig.go index 13047125a..ef14adef8 100644 --- a/services/storage-shares/pkg/config/defaults/defaultconfig.go +++ b/services/storage-shares/pkg/config/defaults/defaultconfig.go @@ -1,6 +1,7 @@ package defaults import ( + "github.com/owncloud/ocis/v2/ocis-pkg/shared" "github.com/owncloud/ocis/v2/services/storage-shares/pkg/config" ) @@ -27,7 +28,7 @@ func DefaultConfig() *config.Config { Service: config.Service{ Name: "storage-shares", }, - Reva: &config.Reva{ + Reva: &shared.Reva{ Address: "127.0.0.1:9142", }, MountID: "7639e57c-4433-4a12-8201-722fd0009154", @@ -61,11 +62,11 @@ func EnsureDefaults(cfg *config.Config) { } if cfg.Reva == nil && cfg.Commons != nil && cfg.Commons.Reva != nil { - cfg.Reva = &config.Reva{ + cfg.Reva = &shared.Reva{ Address: cfg.Commons.Reva.Address, } } else if cfg.Reva == nil { - cfg.Reva = &config.Reva{} + cfg.Reva = &shared.Reva{} } if cfg.TokenManager == nil && cfg.Commons != nil && cfg.Commons.TokenManager != nil { diff --git a/services/storage-shares/pkg/config/reva.go b/services/storage-shares/pkg/config/reva.go index 1905f490a..dc5dd4dde 100644 --- a/services/storage-shares/pkg/config/reva.go +++ b/services/storage-shares/pkg/config/reva.go @@ -1,10 +1,5 @@ package config -// Reva defines all available REVA configuration. -type Reva struct { - Address string `yaml:"address" env:"REVA_GATEWAY" desc:"The CS3 gateway endpoint."` -} - // TokenManager is the config for using the reva token manager type TokenManager struct { JWTSecret string `yaml:"jwt_secret" env:"OCIS_JWT_SECRET;STORAGE_SHARES_JWT_SECRET" desc:"The secret to mint and validate jwt tokens."` diff --git a/services/storage-system/pkg/config/config.go b/services/storage-system/pkg/config/config.go index 5a87745fc..31b23ed72 100644 --- a/services/storage-system/pkg/config/config.go +++ b/services/storage-system/pkg/config/config.go @@ -17,7 +17,7 @@ type Config struct { HTTP HTTPConfig `yaml:"http"` TokenManager *TokenManager `yaml:"token_manager"` - Reva *Reva `yaml:"reva"` + Reva *shared.Reva `yaml:"reva"` SystemUserID string `yaml:"system_user_id" env:"OCIS_SYSTEM_USER_ID" desc:"ID of the oCIS storage-system system user. Admins need to set the ID for the STORAGE-SYSTEM system user in this config option which is then used to reference the user. Any reasonable long string is possible, preferably this would be an UUIDv4 format."` SystemUserAPIKey string `yaml:"system_user_api_key" env:"OCIS_SYSTEM_USER_API_KEY" desc:"API key for the STORAGE-SYSTEM system user."` diff --git a/services/storage-system/pkg/config/defaults/defaultconfig.go b/services/storage-system/pkg/config/defaults/defaultconfig.go index 99188634a..57ba2fe4c 100644 --- a/services/storage-system/pkg/config/defaults/defaultconfig.go +++ b/services/storage-system/pkg/config/defaults/defaultconfig.go @@ -4,6 +4,7 @@ import ( "path/filepath" "github.com/owncloud/ocis/v2/ocis-pkg/config/defaults" + "github.com/owncloud/ocis/v2/ocis-pkg/shared" "github.com/owncloud/ocis/v2/services/storage-system/pkg/config" ) @@ -35,7 +36,7 @@ func DefaultConfig() *config.Config { Service: config.Service{ Name: "storage-system", }, - Reva: &config.Reva{ + Reva: &shared.Reva{ Address: "127.0.0.1:9142", }, DataServerURL: "http://localhost:9216/data", @@ -73,11 +74,11 @@ func EnsureDefaults(cfg *config.Config) { } if cfg.Reva == nil && cfg.Commons != nil && cfg.Commons.Reva != nil { - cfg.Reva = &config.Reva{ + cfg.Reva = &shared.Reva{ Address: cfg.Commons.Reva.Address, } } else if cfg.Reva == nil { - cfg.Reva = &config.Reva{} + cfg.Reva = &shared.Reva{} } if cfg.TokenManager == nil && cfg.Commons != nil && cfg.Commons.TokenManager != nil { diff --git a/services/storage-system/pkg/config/reva.go b/services/storage-system/pkg/config/reva.go index f40101695..5c8ff6d4c 100644 --- a/services/storage-system/pkg/config/reva.go +++ b/services/storage-system/pkg/config/reva.go @@ -1,10 +1,5 @@ package config -// Reva defines all available REVA configuration. -type Reva struct { - Address string `yaml:"address" env:"REVA_GATEWAY" desc:"The CS3 gateway endpoint."` -} - // TokenManager is the config for using the reva token manager type TokenManager struct { JWTSecret string `yaml:"jwt_secret" env:"OCIS_JWT_SECRET;STORAGE_SYSTEM_JWT_SECRET" desc:"The secret to mint and validate jwt tokens."` diff --git a/services/storage-users/pkg/config/config.go b/services/storage-users/pkg/config/config.go index 3081c42e0..d7b24f39f 100644 --- a/services/storage-users/pkg/config/config.go +++ b/services/storage-users/pkg/config/config.go @@ -17,7 +17,7 @@ type Config struct { HTTP HTTPConfig `yaml:"http"` TokenManager *TokenManager `yaml:"token_manager"` - Reva *Reva `yaml:"reva"` + Reva *shared.Reva `yaml:"reva"` SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token" env:"STORAGE_USERS_SKIP_USER_GROUPS_IN_TOKEN" desc:"Disables the loading of user's group memberships from the reva access token."` diff --git a/services/storage-users/pkg/config/defaults/defaultconfig.go b/services/storage-users/pkg/config/defaults/defaultconfig.go index e1f98cb00..c6865dcda 100644 --- a/services/storage-users/pkg/config/defaults/defaultconfig.go +++ b/services/storage-users/pkg/config/defaults/defaultconfig.go @@ -4,6 +4,7 @@ import ( "path/filepath" "github.com/owncloud/ocis/v2/ocis-pkg/config/defaults" + "github.com/owncloud/ocis/v2/ocis-pkg/shared" "github.com/owncloud/ocis/v2/services/storage-users/pkg/config" ) @@ -36,7 +37,7 @@ func DefaultConfig() *config.Config { Service: config.Service{ Name: "storage-users", }, - Reva: &config.Reva{ + Reva: &shared.Reva{ Address: "127.0.0.1:9142", }, DataServerURL: "http://localhost:9158/data", @@ -111,11 +112,11 @@ func EnsureDefaults(cfg *config.Config) { } if cfg.Reva == nil && cfg.Commons != nil && cfg.Commons.Reva != nil { - cfg.Reva = &config.Reva{ + cfg.Reva = &shared.Reva{ Address: cfg.Commons.Reva.Address, } } else if cfg.Reva == nil { - cfg.Reva = &config.Reva{} + cfg.Reva = &shared.Reva{} } if cfg.TokenManager == nil && cfg.Commons != nil && cfg.Commons.TokenManager != nil { diff --git a/services/storage-users/pkg/config/reva.go b/services/storage-users/pkg/config/reva.go index 3eed40006..de111cde3 100644 --- a/services/storage-users/pkg/config/reva.go +++ b/services/storage-users/pkg/config/reva.go @@ -1,10 +1,5 @@ package config -// Reva defines all available REVA configuration. -type Reva struct { - Address string `yaml:"address" env:"REVA_GATEWAY" desc:"The CS3 gateway endpoint."` -} - // TokenManager is the config for using the reva token manager type TokenManager struct { JWTSecret string `yaml:"jwt_secret" env:"OCIS_JWT_SECRET;STORAGE_USERS_JWT_SECRET" desc:"The secret to mint and validate jwt tokens."` diff --git a/services/thumbnails/pkg/config/config.go b/services/thumbnails/pkg/config/config.go index 781a613f7..cd428e14d 100644 --- a/services/thumbnails/pkg/config/config.go +++ b/services/thumbnails/pkg/config/config.go @@ -35,7 +35,7 @@ type Thumbnail struct { FileSystemStorage FileSystemStorage `yaml:"filesystem_storage"` WebdavAllowInsecure bool `yaml:"webdav_allow_insecure" env:"OCIS_INSECURE;THUMBNAILS_WEBDAVSOURCE_INSECURE" desc:"Ignore untrusted SSL certificates when connecting to the webdav source."` CS3AllowInsecure bool `yaml:"cs3_allow_insecure" env:"OCIS_INSECURE;THUMBNAILS_CS3SOURCE_INSECURE" desc:"Ignore untrusted SSL certificates when connecting to the CS3 source."` - RevaGateway string `yaml:"reva_gateway" env:"REVA_GATEWAY" desc:"The CS3 gateway endpoint."` //TODO: use REVA config + Reva shared.Reva `yaml:"reva"` FontMapFile string `yaml:"font_map_file" env:"THUMBNAILS_TXT_FONTMAP_FILE" desc:"The path to a font file for txt thumbnails."` TransferSecret string `yaml:"transfer_secret" env:"THUMBNAILS_TRANSFER_TOKEN" desc:"The secret to sign JWT to download the actual thumbnail file."` DataEndpoint string `yaml:"data_endpoint" env:"THUMBNAILS_DATA_ENDPOINT" desc:"The HTTP endpoint where the actual thumbnail file can be downloaded."` diff --git a/services/thumbnails/pkg/config/defaults/defaultconfig.go b/services/thumbnails/pkg/config/defaults/defaultconfig.go index b6d3f8b7c..b5dccb365 100644 --- a/services/thumbnails/pkg/config/defaults/defaultconfig.go +++ b/services/thumbnails/pkg/config/defaults/defaultconfig.go @@ -5,6 +5,7 @@ import ( "strings" "github.com/owncloud/ocis/v2/ocis-pkg/config/defaults" + "github.com/owncloud/ocis/v2/ocis-pkg/shared" "github.com/owncloud/ocis/v2/services/thumbnails/pkg/config" ) @@ -41,9 +42,11 @@ func DefaultConfig() *config.Config { RootDirectory: path.Join(defaults.BaseDataPath(), "thumbnails"), }, WebdavAllowInsecure: false, - RevaGateway: "127.0.0.1:9142", - CS3AllowInsecure: false, - DataEndpoint: "http://127.0.0.1:9186/thumbnails/data", + Reva: shared.Reva{ + Address: "127.0.0.1:9142", + }, + CS3AllowInsecure: false, + DataEndpoint: "http://127.0.0.1:9186/thumbnails/data", }, } } diff --git a/services/thumbnails/pkg/server/grpc/server.go b/services/thumbnails/pkg/server/grpc/server.go index 9f78524f0..b8e8d8e26 100644 --- a/services/thumbnails/pkg/server/grpc/server.go +++ b/services/thumbnails/pkg/server/grpc/server.go @@ -26,7 +26,7 @@ func NewService(opts ...Option) grpc.Service { grpc.Version(version.GetString()), ) tconf := options.Config.Thumbnail - gc, err := pool.GetGatewayServiceClient(tconf.RevaGateway) + gc, err := pool.GetGatewayServiceClient(tconf.Reva.Address) if err != nil { options.Logger.Error().Err(err).Msg("could not get gateway client") return grpc.Service{} diff --git a/services/users/pkg/config/config.go b/services/users/pkg/config/config.go index 269151597..0fb0ede10 100644 --- a/services/users/pkg/config/config.go +++ b/services/users/pkg/config/config.go @@ -16,7 +16,7 @@ type Config struct { GRPC GRPCConfig `yaml:"grpc"` TokenManager *TokenManager `yaml:"token_manager"` - Reva *Reva `yaml:"reva"` + Reva *shared.Reva `yaml:"reva"` SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token" env:"USERS_SKIP_USER_GROUPS_IN_TOKEN" desc:"Disables the loading of user's group memberships from the reva access token."` diff --git a/services/users/pkg/config/defaults/defaultconfig.go b/services/users/pkg/config/defaults/defaultconfig.go index 2f7e87170..2d93cc13b 100644 --- a/services/users/pkg/config/defaults/defaultconfig.go +++ b/services/users/pkg/config/defaults/defaultconfig.go @@ -4,6 +4,7 @@ import ( "path/filepath" "github.com/owncloud/ocis/v2/ocis-pkg/config/defaults" + "github.com/owncloud/ocis/v2/ocis-pkg/shared" "github.com/owncloud/ocis/v2/services/users/pkg/config" ) @@ -30,7 +31,7 @@ func DefaultConfig() *config.Config { Service: config.Service{ Name: "users", }, - Reva: &config.Reva{ + Reva: &shared.Reva{ Address: "127.0.0.1:9142", }, Driver: "ldap", @@ -106,11 +107,11 @@ func EnsureDefaults(cfg *config.Config) { } if cfg.Reva == nil && cfg.Commons != nil && cfg.Commons.Reva != nil { - cfg.Reva = &config.Reva{ + cfg.Reva = &shared.Reva{ Address: cfg.Commons.Reva.Address, } } else if cfg.Reva == nil { - cfg.Reva = &config.Reva{} + cfg.Reva = &shared.Reva{} } if cfg.TokenManager == nil && cfg.Commons != nil && cfg.Commons.TokenManager != nil { diff --git a/services/users/pkg/config/reva.go b/services/users/pkg/config/reva.go index 110f374c4..5ae000508 100644 --- a/services/users/pkg/config/reva.go +++ b/services/users/pkg/config/reva.go @@ -1,10 +1,5 @@ package config -// Reva defines all available REVA configuration. -type Reva struct { - Address string `yaml:"address" env:"REVA_GATEWAY" desc:"The CS3 gateway endpoint."` -} - // TokenManager is the config for using the reva token manager type TokenManager struct { JWTSecret string `yaml:"jwt_secret" env:"OCIS_JWT_SECRET;USERS_JWT_SECRET" desc:"The secret to mint and validate jwt tokens."` diff --git a/services/webdav/pkg/config/config.go b/services/webdav/pkg/config/config.go index 2e609335a..5e7091983 100644 --- a/services/webdav/pkg/config/config.go +++ b/services/webdav/pkg/config/config.go @@ -18,9 +18,8 @@ type Config struct { HTTP HTTP `yaml:"http"` - OcisPublicURL string `yaml:"ocis_public_url" env:"OCIS_URL;OCIS_PUBLIC_URL" desc:"URL, where oCIS is reachable for users."` - WebdavNamespace string `yaml:"webdav_namespace" env:"WEBDAV_WEBDAV_NAMESPACE" desc:"CS3 path layout to use when forwarding /webdav requests"` - RevaGateway string `yaml:"reva_gateway" env:"REVA_GATEWAY" desc:"The CS3 gateway endpoint."` - - Context context.Context `yaml:"-"` + OcisPublicURL string `yaml:"ocis_public_url" env:"OCIS_URL;OCIS_PUBLIC_URL" desc:"URL, where oCIS is reachable for users."` + WebdavNamespace string `yaml:"webdav_namespace" env:"WEBDAV_WEBDAV_NAMESPACE" desc:"CS3 path layout to use when forwarding /webdav requests"` + Reva shared.Reva `yaml:"reva"` + Context context.Context `yaml:"-"` } diff --git a/services/webdav/pkg/config/defaults/defaultconfig.go b/services/webdav/pkg/config/defaults/defaultconfig.go index 12ded296c..98e98d6c9 100644 --- a/services/webdav/pkg/config/defaults/defaultconfig.go +++ b/services/webdav/pkg/config/defaults/defaultconfig.go @@ -3,6 +3,7 @@ package defaults import ( "strings" + "github.com/owncloud/ocis/v2/ocis-pkg/shared" "github.com/owncloud/ocis/v2/services/webdav/pkg/config" ) @@ -37,7 +38,9 @@ func DefaultConfig() *config.Config { }, OcisPublicURL: "https://127.0.0.1:9200", WebdavNamespace: "/users/{{.Id.OpaqueId}}", - RevaGateway: "127.0.0.1:9142", + Reva: shared.Reva{ + Address: "127.0.0.1:9142", + }, } } diff --git a/services/webdav/pkg/service/v0/service.go b/services/webdav/pkg/service/v0/service.go index 1daa30deb..be33cc7a5 100644 --- a/services/webdav/pkg/service/v0/service.go +++ b/services/webdav/pkg/service/v0/service.go @@ -60,7 +60,7 @@ func NewService(opts ...Option) (Service, error) { // chi.RegisterMethod("REPORT") m.Use(options.Middleware...) - gwc, err := pool.GetGatewayServiceClient(conf.RevaGateway) + gwc, err := pool.GetGatewayServiceClient(conf.Reva.Address) if err != nil { return nil, err }