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-25 11:50:08 +02:00
committed by Ralf Haferkamp
parent 0f507e7aab
commit e373e48383
71 changed files with 130 additions and 206 deletions
+1 -1
View File
@@ -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."`
@@ -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 {
@@ -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."`