Get rid of duplicated Reva config struct

Consolidate all services to use the Reva config struct for the shared package.
This works because all services (except 'notifications', 'thumbnails' and
'webdav') where using the same config keys and environment variables for
setting the reva gateway.
This commit is contained in:
Ralf Haferkamp
2022-10-12 15:48:54 +02:00
committed by Ralf Haferkamp
parent 0f507e7aab
commit e373e48383
71 changed files with 130 additions and 206 deletions

View File

@@ -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'."`

View File

@@ -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 {

View File

@@ -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."`