load reva gateway and token manager from common config
This commit is contained in:
Vendored
+4
-4
@@ -12,11 +12,11 @@
|
||||
],
|
||||
"env": {
|
||||
// log settings for human developers
|
||||
"OCIS_LOG_LEVEL": "debug",
|
||||
"OCIS_LOG_PRETTY": "true",
|
||||
"OCIS_LOG_COLOR": "true",
|
||||
//"OCIS_LOG_LEVEL": "debug",
|
||||
//"OCIS_LOG_PRETTY": "true",
|
||||
//"OCIS_LOG_COLOR": "true",
|
||||
// enable basic auth for dev setup so that we can use curl for testing
|
||||
"PROXY_ENABLE_BASIC_AUTH": "true",
|
||||
//"PROXY_ENABLE_BASIC_AUTH": "true",
|
||||
// set insecure options because we don't have valid certificates in dev environments
|
||||
"OCIS_INSECURE": "true",
|
||||
// demo users
|
||||
|
||||
@@ -103,7 +103,7 @@ func EnsureDefaults(cfg *config.Config) {
|
||||
cfg.TokenManager = &config.TokenManager{
|
||||
JWTSecret: cfg.Commons.TokenManager.JWTSecret,
|
||||
}
|
||||
} else {
|
||||
} else if cfg.TokenManager == nil {
|
||||
cfg.TokenManager = &config.TokenManager{}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
"github.com/gofrs/uuid"
|
||||
"github.com/oklog/run"
|
||||
"github.com/owncloud/ocis/extensions/appprovider/pkg/config"
|
||||
"github.com/owncloud/ocis/extensions/appprovider/pkg/config/parser"
|
||||
"github.com/owncloud/ocis/extensions/storage/pkg/server/debug"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/log"
|
||||
@@ -24,6 +25,9 @@ func AppProvider(cfg *config.Config) *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "app-provider",
|
||||
Usage: "start appprovider for providing apps",
|
||||
Before: func(ctx *cli.Context) error {
|
||||
return parser.ParseConfig(cfg)
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
logCfg := cfg.Logging
|
||||
logger := log.NewLogger(
|
||||
@@ -92,8 +96,8 @@ func appProviderConfigFromStruct(c *cli.Context, cfg *config.Config) map[string]
|
||||
"tracing_service_name": c.Command.Name,
|
||||
},
|
||||
"shared": map[string]interface{}{
|
||||
"jwt_secret": cfg.JWTSecret,
|
||||
"gatewaysvc": cfg.GatewayEndpoint,
|
||||
"jwt_secret": cfg.TokenManager.JWTSecret,
|
||||
"gatewaysvc": cfg.Reva.Address,
|
||||
"skip_user_groups_in_token": cfg.SkipUserGroupsInToken,
|
||||
},
|
||||
"grpc": map[string]interface{}{
|
||||
@@ -114,7 +118,7 @@ func appProviderConfigFromStruct(c *cli.Context, cfg *config.Config) map[string]
|
||||
"app_url": cfg.Drivers.WOPI.AppURL,
|
||||
"insecure_connections": cfg.Drivers.WOPI.Insecure,
|
||||
"iop_secret": cfg.Drivers.WOPI.IopSecret,
|
||||
"jwt_secret": cfg.JWTSecret,
|
||||
"jwt_secret": cfg.TokenManager.JWTSecret,
|
||||
"wopi_url": cfg.Drivers.WOPI.WopiURL,
|
||||
},
|
||||
},
|
||||
|
||||
@@ -12,8 +12,9 @@ type Config struct {
|
||||
|
||||
GRPC GRPCConfig `yaml:"grpc,omitempty"`
|
||||
|
||||
JWTSecret string `yaml:"jwt_secret,omitempty"`
|
||||
GatewayEndpoint string `yaml:"gateway_endpoint,omitempty"`
|
||||
TokenManager *TokenManager `yaml:"token_manager,omitempty"`
|
||||
Reva *Reva `yaml:"reva,omitempty"`
|
||||
|
||||
SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token,omitempty"`
|
||||
ExternalAddr string `yaml:"external_addr,omitempty"`
|
||||
Driver string `yaml:"driver,omitempty"`
|
||||
|
||||
@@ -27,9 +27,10 @@ func DefaultConfig() *config.Config {
|
||||
Service: config.Service{
|
||||
Name: "appprovider",
|
||||
},
|
||||
GatewayEndpoint: "127.0.0.1:9142",
|
||||
JWTSecret: "Pive-Fumkiu4",
|
||||
Driver: "",
|
||||
Reva: &config.Reva{
|
||||
Address: "127.0.0.1:9142",
|
||||
},
|
||||
Driver: "",
|
||||
Drivers: config.Drivers{
|
||||
WOPI: config.WOPIDriver{},
|
||||
},
|
||||
@@ -59,6 +60,22 @@ func EnsureDefaults(cfg *config.Config) {
|
||||
} else if cfg.Tracing == nil {
|
||||
cfg.Tracing = &config.Tracing{}
|
||||
}
|
||||
|
||||
if cfg.Reva == nil && cfg.Commons != nil && cfg.Commons.Reva != nil {
|
||||
cfg.Reva = &config.Reva{
|
||||
Address: cfg.Commons.Reva.Address,
|
||||
}
|
||||
} else if cfg.Reva == nil {
|
||||
cfg.Reva = &config.Reva{}
|
||||
}
|
||||
|
||||
if cfg.TokenManager == nil && cfg.Commons != nil && cfg.Commons.TokenManager != nil {
|
||||
cfg.TokenManager = &config.TokenManager{
|
||||
JWTSecret: cfg.Commons.TokenManager.JWTSecret,
|
||||
}
|
||||
} else if cfg.TokenManager == nil {
|
||||
cfg.TokenManager = &config.TokenManager{}
|
||||
}
|
||||
}
|
||||
|
||||
func Sanitize(cfg *config.Config) {
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package parser
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/owncloud/ocis/extensions/appprovider/pkg/config"
|
||||
"github.com/owncloud/ocis/extensions/appprovider/pkg/config/defaults"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/config/envdecode"
|
||||
)
|
||||
|
||||
// ParseConfig loads accounts configuration from known paths.
|
||||
func ParseConfig(cfg *config.Config) error {
|
||||
_, err := ociscfg.BindSourcesToStructs(cfg.Service.Name, cfg)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
defaults.EnsureDefaults(cfg)
|
||||
|
||||
// load all env variables relevant to the config in the current context.
|
||||
if err := envdecode.Decode(cfg); err != nil {
|
||||
// no environment variable set for this config is an expected "error"
|
||||
if !errors.Is(err, envdecode.ErrNoTargetFieldsAreSet) {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
defaults.Sanitize(cfg)
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package config
|
||||
|
||||
// Reva defines all available REVA configuration.
|
||||
type Reva struct {
|
||||
Address string `yaml:"address" env:"REVA_GATEWAY"`
|
||||
}
|
||||
|
||||
// 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"`
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
"github.com/gofrs/uuid"
|
||||
"github.com/oklog/run"
|
||||
"github.com/owncloud/ocis/extensions/auth-basic/pkg/config"
|
||||
"github.com/owncloud/ocis/extensions/auth-basic/pkg/config/parser"
|
||||
"github.com/owncloud/ocis/extensions/storage/pkg/server/debug"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/ldap"
|
||||
@@ -26,6 +27,9 @@ func AuthBasic(cfg *config.Config) *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "auth-basic",
|
||||
Usage: "start authprovider for basic auth",
|
||||
Before: func(ctx *cli.Context) error {
|
||||
return parser.ParseConfig(cfg)
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
logCfg := cfg.Logging
|
||||
logger := log.NewLogger(
|
||||
@@ -113,8 +117,8 @@ func authBasicConfigFromStruct(c *cli.Context, cfg *config.Config) map[string]in
|
||||
"tracing_service_name": c.Command.Name,
|
||||
},
|
||||
"shared": map[string]interface{}{
|
||||
"jwt_secret": cfg.JWTSecret,
|
||||
"gatewaysvc": cfg.GatewayEndpoint,
|
||||
"jwt_secret": cfg.TokenManager.JWTSecret,
|
||||
"gatewaysvc": cfg.Reva.Address,
|
||||
"skip_user_groups_in_token": cfg.SkipUserGroupsInToken,
|
||||
},
|
||||
"grpc": map[string]interface{}{
|
||||
|
||||
@@ -12,8 +12,9 @@ type Config struct {
|
||||
|
||||
GRPC GRPCConfig `yaml:"grpc,omitempty"`
|
||||
|
||||
JWTSecret string `yaml:"jwt_secret,omitempty"`
|
||||
GatewayEndpoint string `yaml:"gateway_endpoint,omitempty"`
|
||||
TokenManager *TokenManager `yaml:"token_manager,omitempty"`
|
||||
Reva *Reva `yaml:"reva,omitempty"`
|
||||
|
||||
SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token,omitempty"`
|
||||
AuthProvider string `yaml:"auth_provider,omitempty" env:"AUTH_BASIC_AUTH_PROVIDER" desc:"The auth provider which should be used by the service"`
|
||||
AuthProviders AuthProviders `yaml:"auth_providers,omitempty"`
|
||||
|
||||
@@ -30,9 +30,10 @@ func DefaultConfig() *config.Config {
|
||||
Service: config.Service{
|
||||
Name: "auth-basic",
|
||||
},
|
||||
GatewayEndpoint: "127.0.0.1:9142",
|
||||
JWTSecret: "Pive-Fumkiu4",
|
||||
AuthProvider: "ldap",
|
||||
Reva: &config.Reva{
|
||||
Address: "127.0.0.1:9142",
|
||||
},
|
||||
AuthProvider: "ldap",
|
||||
AuthProviders: config.AuthProviders{
|
||||
LDAP: config.LDAPProvider{
|
||||
URI: "ldaps://localhost:9126",
|
||||
@@ -101,6 +102,23 @@ func EnsureDefaults(cfg *config.Config) {
|
||||
} else if cfg.Tracing == nil {
|
||||
cfg.Tracing = &config.Tracing{}
|
||||
}
|
||||
|
||||
if cfg.Reva == nil && cfg.Commons != nil && cfg.Commons.Reva != nil {
|
||||
cfg.Reva = &config.Reva{
|
||||
Address: cfg.Commons.Reva.Address,
|
||||
}
|
||||
} else if cfg.Reva == nil {
|
||||
cfg.Reva = &config.Reva{}
|
||||
}
|
||||
|
||||
if cfg.TokenManager == nil && cfg.Commons != nil && cfg.Commons.TokenManager != nil {
|
||||
cfg.TokenManager = &config.TokenManager{
|
||||
JWTSecret: cfg.Commons.TokenManager.JWTSecret,
|
||||
}
|
||||
} else if cfg.TokenManager == nil {
|
||||
cfg.TokenManager = &config.TokenManager{}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func Sanitize(cfg *config.Config) {
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package parser
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/owncloud/ocis/extensions/auth-basic/pkg/config"
|
||||
"github.com/owncloud/ocis/extensions/auth-basic/pkg/config/defaults"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/config/envdecode"
|
||||
)
|
||||
|
||||
// ParseConfig loads accounts configuration from known paths.
|
||||
func ParseConfig(cfg *config.Config) error {
|
||||
_, err := ociscfg.BindSourcesToStructs(cfg.Service.Name, cfg)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
defaults.EnsureDefaults(cfg)
|
||||
|
||||
// load all env variables relevant to the config in the current context.
|
||||
if err := envdecode.Decode(cfg); err != nil {
|
||||
// no environment variable set for this config is an expected "error"
|
||||
if !errors.Is(err, envdecode.ErrNoTargetFieldsAreSet) {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
defaults.Sanitize(cfg)
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package config
|
||||
|
||||
// Reva defines all available REVA configuration.
|
||||
type Reva struct {
|
||||
Address string `yaml:"address" env:"REVA_GATEWAY"`
|
||||
}
|
||||
|
||||
// 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"`
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
"github.com/gofrs/uuid"
|
||||
"github.com/oklog/run"
|
||||
"github.com/owncloud/ocis/extensions/auth-bearer/pkg/config"
|
||||
"github.com/owncloud/ocis/extensions/auth-bearer/pkg/config/parser"
|
||||
"github.com/owncloud/ocis/extensions/storage/pkg/server/debug"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/log"
|
||||
@@ -24,6 +25,9 @@ func AuthBearer(cfg *config.Config) *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "auth-bearer",
|
||||
Usage: "start authprovider for bearer auth",
|
||||
Before: func(ctx *cli.Context) error {
|
||||
return parser.ParseConfig(cfg)
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
logCfg := cfg.Logging
|
||||
logger := log.NewLogger(
|
||||
@@ -94,8 +98,8 @@ func authBearerConfigFromStruct(c *cli.Context, cfg *config.Config) map[string]i
|
||||
"tracing_service_name": c.Command.Name,
|
||||
},
|
||||
"shared": map[string]interface{}{
|
||||
"jwt_secret": cfg.JWTSecret,
|
||||
"gatewaysvc": cfg.GatewayEndpoint,
|
||||
"jwt_secret": cfg.TokenManager.JWTSecret,
|
||||
"gatewaysvc": cfg.Reva.Address,
|
||||
"skip_user_groups_in_token": cfg.SkipUserGroupsInToken,
|
||||
},
|
||||
"grpc": map[string]interface{}{
|
||||
|
||||
@@ -12,8 +12,9 @@ type Config struct {
|
||||
|
||||
GRPC GRPCConfig `yaml:"grpc,omitempty"`
|
||||
|
||||
JWTSecret string `yaml:"jwt_secret,omitempty"`
|
||||
GatewayEndpoint string `yaml:"gateway_endpoint,omitempty"`
|
||||
TokenManager *TokenManager `yaml:"token_manager,omitempty"`
|
||||
Reva *Reva `yaml:"reva,omitempty"`
|
||||
|
||||
SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token,omitempty"`
|
||||
AuthProvider string `yaml:"auth_provider,omitempty" env:"AUTH_BEARER_AUTH_PROVIDER" desc:"The auth provider which should be used by the service"`
|
||||
AuthProviders AuthProviders `yaml:"auth_providers,omitempty"`
|
||||
|
||||
@@ -27,9 +27,10 @@ func DefaultConfig() *config.Config {
|
||||
Service: config.Service{
|
||||
Name: "auth-bearer",
|
||||
},
|
||||
GatewayEndpoint: "127.0.0.1:9142",
|
||||
JWTSecret: "Pive-Fumkiu4",
|
||||
AuthProvider: "ldap",
|
||||
Reva: &config.Reva{
|
||||
Address: "127.0.0.1:9142",
|
||||
},
|
||||
AuthProvider: "ldap",
|
||||
AuthProviders: config.AuthProviders{
|
||||
OIDC: config.OIDCProvider{
|
||||
Issuer: "https://localhost:9200",
|
||||
@@ -63,6 +64,22 @@ func EnsureDefaults(cfg *config.Config) {
|
||||
} else if cfg.Tracing == nil {
|
||||
cfg.Tracing = &config.Tracing{}
|
||||
}
|
||||
|
||||
if cfg.Reva == nil && cfg.Commons != nil && cfg.Commons.Reva != nil {
|
||||
cfg.Reva = &config.Reva{
|
||||
Address: cfg.Commons.Reva.Address,
|
||||
}
|
||||
} else if cfg.Reva == nil {
|
||||
cfg.Reva = &config.Reva{}
|
||||
}
|
||||
|
||||
if cfg.TokenManager == nil && cfg.Commons != nil && cfg.Commons.TokenManager != nil {
|
||||
cfg.TokenManager = &config.TokenManager{
|
||||
JWTSecret: cfg.Commons.TokenManager.JWTSecret,
|
||||
}
|
||||
} else if cfg.TokenManager == nil {
|
||||
cfg.TokenManager = &config.TokenManager{}
|
||||
}
|
||||
}
|
||||
|
||||
func Sanitize(cfg *config.Config) {
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package parser
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/owncloud/ocis/extensions/auth-bearer/pkg/config"
|
||||
"github.com/owncloud/ocis/extensions/auth-bearer/pkg/config/defaults"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/config/envdecode"
|
||||
)
|
||||
|
||||
// ParseConfig loads accounts configuration from known paths.
|
||||
func ParseConfig(cfg *config.Config) error {
|
||||
_, err := ociscfg.BindSourcesToStructs(cfg.Service.Name, cfg)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
defaults.EnsureDefaults(cfg)
|
||||
|
||||
// load all env variables relevant to the config in the current context.
|
||||
if err := envdecode.Decode(cfg); err != nil {
|
||||
// no environment variable set for this config is an expected "error"
|
||||
if !errors.Is(err, envdecode.ErrNoTargetFieldsAreSet) {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
defaults.Sanitize(cfg)
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package config
|
||||
|
||||
// Reva defines all available REVA configuration.
|
||||
type Reva struct {
|
||||
Address string `yaml:"address" env:"REVA_GATEWAY"`
|
||||
}
|
||||
|
||||
// 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"`
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
"github.com/gofrs/uuid"
|
||||
"github.com/oklog/run"
|
||||
"github.com/owncloud/ocis/extensions/auth-machine/pkg/config"
|
||||
"github.com/owncloud/ocis/extensions/auth-machine/pkg/config/parser"
|
||||
"github.com/owncloud/ocis/extensions/storage/pkg/server/debug"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/log"
|
||||
@@ -24,6 +25,9 @@ func AuthMachine(cfg *config.Config) *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "auth-machine",
|
||||
Usage: "start authprovider for machine auth",
|
||||
Before: func(ctx *cli.Context) error {
|
||||
return parser.ParseConfig(cfg)
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
logCfg := cfg.Logging
|
||||
logger := log.NewLogger(
|
||||
@@ -94,8 +98,8 @@ func authMachineConfigFromStruct(c *cli.Context, cfg *config.Config) map[string]
|
||||
"tracing_service_name": c.Command.Name,
|
||||
},
|
||||
"shared": map[string]interface{}{
|
||||
"jwt_secret": cfg.JWTSecret,
|
||||
"gatewaysvc": cfg.GatewayEndpoint,
|
||||
"jwt_secret": cfg.TokenManager.JWTSecret,
|
||||
"gatewaysvc": cfg.Reva.Address,
|
||||
"skip_user_groups_in_token": cfg.SkipUserGroupsInToken,
|
||||
},
|
||||
"grpc": map[string]interface{}{
|
||||
@@ -108,7 +112,7 @@ func authMachineConfigFromStruct(c *cli.Context, cfg *config.Config) map[string]
|
||||
"auth_managers": map[string]interface{}{
|
||||
"machine": map[string]interface{}{
|
||||
"api_key": cfg.AuthProviders.Machine.APIKey,
|
||||
"gateway_addr": cfg.GatewayEndpoint,
|
||||
"gateway_addr": cfg.Reva.Address,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -12,8 +12,9 @@ type Config struct {
|
||||
|
||||
GRPC GRPCConfig `yaml:"grpc,omitempty"`
|
||||
|
||||
JWTSecret string `yaml:"jwt_secret,omitempty"`
|
||||
GatewayEndpoint string `yaml:"gateway_entpoint,omitempty"`
|
||||
TokenManager *TokenManager `yaml:"token_manager,omitempty"`
|
||||
Reva *Reva `yaml:"reva,omitempty"`
|
||||
|
||||
SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token,omitempty"`
|
||||
AuthProvider string `yaml:"auth_provider,omitempty" env:"AUTH_MACHINE_AUTH_PROVIDER" desc:"The auth provider which should be used by the service"`
|
||||
AuthProviders AuthProviders `yaml:"auth_providers,omitempty"`
|
||||
|
||||
@@ -27,9 +27,10 @@ func DefaultConfig() *config.Config {
|
||||
Service: config.Service{
|
||||
Name: "auth-machine",
|
||||
},
|
||||
GatewayEndpoint: "127.0.0.1:9142",
|
||||
JWTSecret: "Pive-Fumkiu4",
|
||||
AuthProvider: "ldap",
|
||||
Reva: &config.Reva{
|
||||
Address: "127.0.0.1:9142",
|
||||
},
|
||||
AuthProvider: "ldap",
|
||||
AuthProviders: config.AuthProviders{
|
||||
Machine: config.MachineProvider{
|
||||
APIKey: "change-me-please",
|
||||
@@ -61,6 +62,22 @@ func EnsureDefaults(cfg *config.Config) {
|
||||
} else if cfg.Tracing == nil {
|
||||
cfg.Tracing = &config.Tracing{}
|
||||
}
|
||||
|
||||
if cfg.Reva == nil && cfg.Commons != nil && cfg.Commons.Reva != nil {
|
||||
cfg.Reva = &config.Reva{
|
||||
Address: cfg.Commons.Reva.Address,
|
||||
}
|
||||
} else if cfg.Reva == nil {
|
||||
cfg.Reva = &config.Reva{}
|
||||
}
|
||||
|
||||
if cfg.TokenManager == nil && cfg.Commons != nil && cfg.Commons.TokenManager != nil {
|
||||
cfg.TokenManager = &config.TokenManager{
|
||||
JWTSecret: cfg.Commons.TokenManager.JWTSecret,
|
||||
}
|
||||
} else if cfg.TokenManager == nil {
|
||||
cfg.TokenManager = &config.TokenManager{}
|
||||
}
|
||||
}
|
||||
|
||||
func Sanitize(cfg *config.Config) {
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package parser
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/owncloud/ocis/extensions/auth-machine/pkg/config"
|
||||
"github.com/owncloud/ocis/extensions/auth-machine/pkg/config/defaults"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/config/envdecode"
|
||||
)
|
||||
|
||||
// ParseConfig loads accounts configuration from known paths.
|
||||
func ParseConfig(cfg *config.Config) error {
|
||||
_, err := ociscfg.BindSourcesToStructs(cfg.Service.Name, cfg)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
defaults.EnsureDefaults(cfg)
|
||||
|
||||
// load all env variables relevant to the config in the current context.
|
||||
if err := envdecode.Decode(cfg); err != nil {
|
||||
// no environment variable set for this config is an expected "error"
|
||||
if !errors.Is(err, envdecode.ErrNoTargetFieldsAreSet) {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
defaults.Sanitize(cfg)
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package config
|
||||
|
||||
// Reva defines all available REVA configuration.
|
||||
type Reva struct {
|
||||
Address string `yaml:"address" env:"REVA_GATEWAY"`
|
||||
}
|
||||
|
||||
// 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"`
|
||||
}
|
||||
@@ -13,6 +13,7 @@ import (
|
||||
"github.com/gofrs/uuid"
|
||||
"github.com/oklog/run"
|
||||
"github.com/owncloud/ocis/extensions/frontend/pkg/config"
|
||||
"github.com/owncloud/ocis/extensions/frontend/pkg/config/parser"
|
||||
"github.com/owncloud/ocis/extensions/storage/pkg/server/debug"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/conversions"
|
||||
@@ -28,11 +29,13 @@ func Frontend(cfg *config.Config) *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "frontend",
|
||||
Usage: "start frontend service",
|
||||
Before: func(c *cli.Context) error {
|
||||
if err := loadUserAgent(c, cfg); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
Before: func(ctx *cli.Context) error {
|
||||
// TODO: what !?
|
||||
//if err := loadUserAgent(c, cfg); err != nil {
|
||||
// return err
|
||||
//}
|
||||
//return nil
|
||||
return parser.ParseConfig(cfg)
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
logCfg := cfg.Logging
|
||||
@@ -156,8 +159,8 @@ func frontendConfigFromStruct(c *cli.Context, cfg *config.Config, filesCfg map[s
|
||||
"tracing_service_name": c.Command.Name,
|
||||
},
|
||||
"shared": map[string]interface{}{
|
||||
"jwt_secret": cfg.JWTSecret,
|
||||
"gatewaysvc": cfg.GatewayEndpoint, // Todo or address?
|
||||
"jwt_secret": cfg.TokenManager.JWTSecret,
|
||||
"gatewaysvc": cfg.Reva.Address, // Todo or address?
|
||||
"skip_user_groups_in_token": cfg.SkipUserGroupsInToken,
|
||||
},
|
||||
"http": map[string]interface{}{
|
||||
@@ -194,7 +197,7 @@ func frontendConfigFromStruct(c *cli.Context, cfg *config.Config, filesCfg map[s
|
||||
"insecure": true,
|
||||
},
|
||||
"ocs": map[string]interface{}{
|
||||
"storage_registry_svc": cfg.GatewayEndpoint,
|
||||
"storage_registry_svc": cfg.Reva.Address,
|
||||
"share_prefix": cfg.OCS.SharePrefix,
|
||||
"home_namespace": cfg.OCS.HomeNamespace,
|
||||
"resource_info_cache_ttl": cfg.OCS.ResourceInfoCacheTTL,
|
||||
@@ -210,7 +213,7 @@ func frontendConfigFromStruct(c *cli.Context, cfg *config.Config, filesCfg map[s
|
||||
"db_port": cfg.OCS.CacheWarmupDrivers.CBOX.DBPort,
|
||||
"db_name": cfg.OCS.CacheWarmupDrivers.CBOX.DBName,
|
||||
"namespace": cfg.OCS.CacheWarmupDrivers.CBOX.Namespace,
|
||||
"gatewaysvc": cfg.GatewayEndpoint,
|
||||
"gatewaysvc": cfg.Reva.Address,
|
||||
},
|
||||
},
|
||||
"config": map[string]interface{}{
|
||||
|
||||
@@ -16,8 +16,9 @@ type Config struct {
|
||||
|
||||
TransferSecret string `yaml:"transfer_secret" env:"STORAGE_TRANSFER_SECRET"`
|
||||
|
||||
JWTSecret string `yaml:"jwt_secret"`
|
||||
GatewayEndpoint string
|
||||
TokenManager *TokenManager `yaml:"token_manager,omitempty"`
|
||||
Reva *Reva `yaml:"reva,omitempty"`
|
||||
|
||||
SkipUserGroupsInToken bool
|
||||
|
||||
EnableFavorites bool `yaml:"favorites"`
|
||||
|
||||
@@ -28,8 +28,9 @@ func DefaultConfig() *config.Config {
|
||||
Service: config.Service{
|
||||
Name: "frontend",
|
||||
},
|
||||
GatewayEndpoint: "127.0.0.1:9142",
|
||||
JWTSecret: "Pive-Fumkiu4",
|
||||
Reva: &config.Reva{
|
||||
Address: "127.0.0.1:9142",
|
||||
},
|
||||
PublicURL: "https://localhost:9200",
|
||||
EnableFavorites: false,
|
||||
EnableProjectSpaces: true,
|
||||
@@ -96,6 +97,22 @@ func EnsureDefaults(cfg *config.Config) {
|
||||
} else if cfg.Tracing == nil {
|
||||
cfg.Tracing = &config.Tracing{}
|
||||
}
|
||||
|
||||
if cfg.Reva == nil && cfg.Commons != nil && cfg.Commons.Reva != nil {
|
||||
cfg.Reva = &config.Reva{
|
||||
Address: cfg.Commons.Reva.Address,
|
||||
}
|
||||
} else if cfg.Reva == nil {
|
||||
cfg.Reva = &config.Reva{}
|
||||
}
|
||||
|
||||
if cfg.TokenManager == nil && cfg.Commons != nil && cfg.Commons.TokenManager != nil {
|
||||
cfg.TokenManager = &config.TokenManager{
|
||||
JWTSecret: cfg.Commons.TokenManager.JWTSecret,
|
||||
}
|
||||
} else if cfg.TokenManager == nil {
|
||||
cfg.TokenManager = &config.TokenManager{}
|
||||
}
|
||||
}
|
||||
|
||||
func Sanitize(cfg *config.Config) {
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package parser
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/owncloud/ocis/extensions/frontend/pkg/config"
|
||||
"github.com/owncloud/ocis/extensions/frontend/pkg/config/defaults"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/config/envdecode"
|
||||
)
|
||||
|
||||
// ParseConfig loads accounts configuration from known paths.
|
||||
func ParseConfig(cfg *config.Config) error {
|
||||
_, err := ociscfg.BindSourcesToStructs(cfg.Service.Name, cfg)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
defaults.EnsureDefaults(cfg)
|
||||
|
||||
// load all env variables relevant to the config in the current context.
|
||||
if err := envdecode.Decode(cfg); err != nil {
|
||||
// no environment variable set for this config is an expected "error"
|
||||
if !errors.Is(err, envdecode.ErrNoTargetFieldsAreSet) {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
defaults.Sanitize(cfg)
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package config
|
||||
|
||||
// Reva defines all available REVA configuration.
|
||||
type Reva struct {
|
||||
Address string `yaml:"address" env:"REVA_GATEWAY"`
|
||||
}
|
||||
|
||||
// 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"`
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import (
|
||||
"github.com/mitchellh/mapstructure"
|
||||
"github.com/oklog/run"
|
||||
"github.com/owncloud/ocis/extensions/gateway/pkg/config"
|
||||
"github.com/owncloud/ocis/extensions/gateway/pkg/config/parser"
|
||||
"github.com/owncloud/ocis/extensions/storage/pkg/server/debug"
|
||||
"github.com/owncloud/ocis/extensions/storage/pkg/service/external"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
@@ -30,12 +31,8 @@ func Gateway(cfg *config.Config) *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "gateway",
|
||||
Usage: "start gateway",
|
||||
Before: func(c *cli.Context) error {
|
||||
if cfg.DataGatewayPublicURL == "" {
|
||||
cfg.DataGatewayPublicURL = strings.TrimRight(cfg.FrontendPublicURL, "/") + "/data"
|
||||
}
|
||||
|
||||
return nil
|
||||
Before: func(ctx *cli.Context) error {
|
||||
return parser.ParseConfig(cfg)
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
logCfg := cfg.Logging
|
||||
@@ -124,8 +121,8 @@ func gatewayConfigFromStruct(c *cli.Context, cfg *config.Config, logger log.Logg
|
||||
"tracing_service_name": c.Command.Name,
|
||||
},
|
||||
"shared": map[string]interface{}{
|
||||
"jwt_secret": cfg.JWTSecret,
|
||||
"gatewaysvc": cfg.GatewayEndpoint,
|
||||
"jwt_secret": cfg.TokenManager.JWTSecret,
|
||||
"gatewaysvc": cfg.Reva.Address,
|
||||
"skip_user_groups_in_token": cfg.SkipUserGroupsInToken,
|
||||
},
|
||||
"grpc": map[string]interface{}{
|
||||
@@ -135,9 +132,9 @@ func gatewayConfigFromStruct(c *cli.Context, cfg *config.Config, logger log.Logg
|
||||
"services": map[string]interface{}{
|
||||
"gateway": map[string]interface{}{
|
||||
// registries is located on the gateway
|
||||
"authregistrysvc": cfg.GatewayEndpoint,
|
||||
"storageregistrysvc": cfg.GatewayEndpoint,
|
||||
"appregistrysvc": cfg.GatewayEndpoint,
|
||||
"authregistrysvc": cfg.Reva.Address,
|
||||
"storageregistrysvc": cfg.Reva.Address,
|
||||
"appregistrysvc": cfg.Reva.Address,
|
||||
// user metadata is located on the users services
|
||||
"preferencessvc": cfg.UsersEndpoint,
|
||||
"userprovidersvc": cfg.UsersEndpoint,
|
||||
@@ -152,7 +149,7 @@ func gatewayConfigFromStruct(c *cli.Context, cfg *config.Config, logger log.Logg
|
||||
"share_folder": cfg.ShareFolder, // ShareFolder is the location where to create shares in the recipient's storage provider.
|
||||
// other
|
||||
"disable_home_creation_on_login": cfg.DisableHomeCreationOnLogin,
|
||||
"datagateway": cfg.DataGatewayPublicURL,
|
||||
"datagateway": strings.TrimRight(cfg.FrontendPublicURL, "/") + "/data",
|
||||
"transfer_shared_secret": cfg.TransferSecret,
|
||||
"transfer_expires": cfg.TransferExpires,
|
||||
"home_mapping": cfg.HomeMapping,
|
||||
|
||||
@@ -12,9 +12,10 @@ type Config struct {
|
||||
|
||||
GRPC GRPCConfig `yaml:"grpc,omitempty"`
|
||||
|
||||
JWTSecret string `yaml:"jwt_secret,omitempty"`
|
||||
GatewayEndpoint string `yaml:",omitempty"`
|
||||
SkipUserGroupsInToken bool `yaml:",omitempty"`
|
||||
TokenManager *TokenManager `yaml:"token_manager,omitempty"`
|
||||
Reva *Reva `yaml:"reva,omitempty"`
|
||||
|
||||
SkipUserGroupsInToken bool `yaml:",omitempty"`
|
||||
|
||||
CommitShareToStorageGrant bool `yaml:"commit_share_to_storage_grant,omitempty"`
|
||||
CommitShareToStorageRef bool `yaml:"commit_share_to_storage_ref,omitempty"`
|
||||
@@ -29,7 +30,6 @@ type Config struct {
|
||||
GroupsEndpoint string `yaml:"groups_endpoint,omitempty"`
|
||||
PermissionsEndpoint string `yaml:"permissions_endpoint,omitempty"`
|
||||
SharingEndpoint string `yaml:"sharing_endpoint,omitempty"`
|
||||
DataGatewayPublicURL string `yaml:"data_gateway_public_url,omitempty"`
|
||||
FrontendPublicURL string `yaml:"frontend_public_url,omitempty" env:"OCIS_URL;GATEWAY_FRONTEND_PUBLIC_URL"`
|
||||
AuthBasicEndpoint string `yaml:"auth_basic_endpoint,omitempty"`
|
||||
AuthBearerEndpoint string `yaml:"auth_bearer_endpoint,omitempty"`
|
||||
|
||||
@@ -27,8 +27,9 @@ func DefaultConfig() *config.Config {
|
||||
Service: config.Service{
|
||||
Name: "gateway",
|
||||
},
|
||||
GatewayEndpoint: "127.0.0.1:9142",
|
||||
JWTSecret: "Pive-Fumkiu4",
|
||||
Reva: &config.Reva{
|
||||
Address: "127.0.0.1:9142",
|
||||
},
|
||||
|
||||
CommitShareToStorageGrant: true,
|
||||
CommitShareToStorageRef: true,
|
||||
@@ -43,7 +44,6 @@ func DefaultConfig() *config.Config {
|
||||
GroupsEndpoint: "localhost:9160",
|
||||
PermissionsEndpoint: "localhost:9191",
|
||||
SharingEndpoint: "localhost:9150",
|
||||
DataGatewayPublicURL: "",
|
||||
FrontendPublicURL: "https://localhost:9200",
|
||||
AuthBasicEndpoint: "localhost:9146",
|
||||
AuthBearerEndpoint: "localhost:9148",
|
||||
@@ -85,6 +85,22 @@ func EnsureDefaults(cfg *config.Config) {
|
||||
} else if cfg.Tracing == nil {
|
||||
cfg.Tracing = &config.Tracing{}
|
||||
}
|
||||
|
||||
if cfg.Reva == nil && cfg.Commons != nil && cfg.Commons.Reva != nil {
|
||||
cfg.Reva = &config.Reva{
|
||||
Address: cfg.Commons.Reva.Address,
|
||||
}
|
||||
} else if cfg.Reva == nil {
|
||||
cfg.Reva = &config.Reva{}
|
||||
}
|
||||
|
||||
if cfg.TokenManager == nil && cfg.Commons != nil && cfg.Commons.TokenManager != nil {
|
||||
cfg.TokenManager = &config.TokenManager{
|
||||
JWTSecret: cfg.Commons.TokenManager.JWTSecret,
|
||||
}
|
||||
} else if cfg.TokenManager == nil {
|
||||
cfg.TokenManager = &config.TokenManager{}
|
||||
}
|
||||
}
|
||||
|
||||
func Sanitize(cfg *config.Config) {
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package parser
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/owncloud/ocis/extensions/gateway/pkg/config"
|
||||
"github.com/owncloud/ocis/extensions/gateway/pkg/config/defaults"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/config/envdecode"
|
||||
)
|
||||
|
||||
// ParseConfig loads accounts configuration from known paths.
|
||||
func ParseConfig(cfg *config.Config) error {
|
||||
_, err := ociscfg.BindSourcesToStructs(cfg.Service.Name, cfg)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
defaults.EnsureDefaults(cfg)
|
||||
|
||||
// load all env variables relevant to the config in the current context.
|
||||
if err := envdecode.Decode(cfg); err != nil {
|
||||
// no environment variable set for this config is an expected "error"
|
||||
if !errors.Is(err, envdecode.ErrNoTargetFieldsAreSet) {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
defaults.Sanitize(cfg)
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package config
|
||||
|
||||
// Reva defines all available REVA configuration.
|
||||
type Reva struct {
|
||||
Address string `yaml:"address" env:"REVA_GATEWAY"`
|
||||
}
|
||||
|
||||
// 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"`
|
||||
}
|
||||
@@ -18,7 +18,7 @@ type Config struct {
|
||||
|
||||
HTTP HTTP `yaml:"http,omitempty"`
|
||||
|
||||
Reva Reva `yaml:"reva,omitempty"`
|
||||
Reva *Reva `yaml:"reva,omitempty"`
|
||||
TokenManager *TokenManager `yaml:"token_manager,omitempty"`
|
||||
|
||||
Spaces Spaces `yaml:"spaces,omitempty"`
|
||||
|
||||
@@ -20,7 +20,7 @@ func DefaultConfig() *config.Config {
|
||||
Service: config.Service{
|
||||
Name: "graph",
|
||||
},
|
||||
Reva: config.Reva{
|
||||
Reva: &config.Reva{
|
||||
Address: "127.0.0.1:9142",
|
||||
},
|
||||
Spaces: config.Spaces{
|
||||
@@ -91,7 +91,7 @@ func EnsureDefaults(cfg *config.Config) {
|
||||
cfg.TokenManager = &config.TokenManager{
|
||||
JWTSecret: cfg.Commons.TokenManager.JWTSecret,
|
||||
}
|
||||
} else {
|
||||
} else if cfg.TokenManager == nil {
|
||||
cfg.TokenManager = &config.TokenManager{}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ func NewService(opts ...Option) Service {
|
||||
switch options.Config.Identity.Backend {
|
||||
case "cs3":
|
||||
backend = &identity.CS3{
|
||||
Config: &options.Config.Reva,
|
||||
Config: options.Config.Reva,
|
||||
Logger: &options.Logger,
|
||||
}
|
||||
case "ldap":
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
"github.com/gofrs/uuid"
|
||||
"github.com/oklog/run"
|
||||
"github.com/owncloud/ocis/extensions/group/pkg/config"
|
||||
"github.com/owncloud/ocis/extensions/group/pkg/config/parser"
|
||||
"github.com/owncloud/ocis/extensions/storage/pkg/server/debug"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/ldap"
|
||||
@@ -26,6 +27,9 @@ func Groups(cfg *config.Config) *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "groups",
|
||||
Usage: "start groups service",
|
||||
Before: func(ctx *cli.Context) error {
|
||||
return parser.ParseConfig(cfg)
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
logCfg := cfg.Logging
|
||||
logger := log.NewLogger(
|
||||
@@ -111,8 +115,8 @@ func groupsConfigFromStruct(c *cli.Context, cfg *config.Config) map[string]inter
|
||||
"tracing_service_name": c.Command.Name,
|
||||
},
|
||||
"shared": map[string]interface{}{
|
||||
"jwt_secret": cfg.JWTSecret,
|
||||
"gatewaysvc": cfg.GatewayEndpoint,
|
||||
"jwt_secret": cfg.TokenManager.JWTSecret,
|
||||
"gatewaysvc": cfg.Reva.Address,
|
||||
"skip_user_groups_in_token": cfg.SkipUserGroupsInToken,
|
||||
},
|
||||
"grpc": map[string]interface{}{
|
||||
|
||||
@@ -12,8 +12,9 @@ type Config struct {
|
||||
|
||||
GRPC GRPCConfig `yaml:"grpc,omitempty"`
|
||||
|
||||
JWTSecret string `yaml:"jwt_secret,omitempty"`
|
||||
GatewayEndpoint string `yaml:"gateway_endpoint,omitempty"`
|
||||
TokenManager *TokenManager `yaml:"token_manager,omitempty"`
|
||||
Reva *Reva `yaml:"reva,omitempty"`
|
||||
|
||||
SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token,omitempty"`
|
||||
GroupMembersCacheExpiration int `yaml:"group_members_cache_expiration,omitempty"`
|
||||
Driver string `yaml:"driver,omitempty"`
|
||||
|
||||
@@ -31,9 +31,10 @@ func DefaultConfig() *config.Config {
|
||||
Name: "user",
|
||||
},
|
||||
GroupMembersCacheExpiration: 5,
|
||||
GatewayEndpoint: "127.0.0.1:9142",
|
||||
JWTSecret: "Pive-Fumkiu4",
|
||||
Driver: "ldap",
|
||||
Reva: &config.Reva{
|
||||
Address: "127.0.0.1:9142",
|
||||
},
|
||||
Driver: "ldap",
|
||||
Drivers: config.Drivers{
|
||||
LDAP: config.LDAPDriver{
|
||||
URI: "ldaps://localhost:9126",
|
||||
@@ -106,6 +107,22 @@ func EnsureDefaults(cfg *config.Config) {
|
||||
} else if cfg.Tracing == nil {
|
||||
cfg.Tracing = &config.Tracing{}
|
||||
}
|
||||
|
||||
if cfg.Reva == nil && cfg.Commons != nil && cfg.Commons.Reva != nil {
|
||||
cfg.Reva = &config.Reva{
|
||||
Address: cfg.Commons.Reva.Address,
|
||||
}
|
||||
} else if cfg.Reva == nil {
|
||||
cfg.Reva = &config.Reva{}
|
||||
}
|
||||
|
||||
if cfg.TokenManager == nil && cfg.Commons != nil && cfg.Commons.TokenManager != nil {
|
||||
cfg.TokenManager = &config.TokenManager{
|
||||
JWTSecret: cfg.Commons.TokenManager.JWTSecret,
|
||||
}
|
||||
} else if cfg.TokenManager == nil {
|
||||
cfg.TokenManager = &config.TokenManager{}
|
||||
}
|
||||
}
|
||||
|
||||
func Sanitize(cfg *config.Config) {
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package parser
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/owncloud/ocis/extensions/group/pkg/config"
|
||||
"github.com/owncloud/ocis/extensions/group/pkg/config/defaults"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/config/envdecode"
|
||||
)
|
||||
|
||||
// ParseConfig loads accounts configuration from known paths.
|
||||
func ParseConfig(cfg *config.Config) error {
|
||||
_, err := ociscfg.BindSourcesToStructs(cfg.Service.Name, cfg)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
defaults.EnsureDefaults(cfg)
|
||||
|
||||
// load all env variables relevant to the config in the current context.
|
||||
if err := envdecode.Decode(cfg); err != nil {
|
||||
// no environment variable set for this config is an expected "error"
|
||||
if !errors.Is(err, envdecode.ErrNoTargetFieldsAreSet) {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
defaults.Sanitize(cfg)
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package config
|
||||
|
||||
// Reva defines all available REVA configuration.
|
||||
type Reva struct {
|
||||
Address string `yaml:"address" env:"REVA_GATEWAY"`
|
||||
}
|
||||
|
||||
// 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"`
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"github.com/cs3org/reva/v2/pkg/micro/ocdav"
|
||||
"github.com/oklog/run"
|
||||
"github.com/owncloud/ocis/extensions/ocdav/pkg/config"
|
||||
"github.com/owncloud/ocis/extensions/ocdav/pkg/config/parser"
|
||||
"github.com/owncloud/ocis/extensions/storage/pkg/server/debug"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/conversions"
|
||||
@@ -25,11 +26,15 @@ func OCDav(cfg *config.Config) *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "ocdav",
|
||||
Usage: "start ocdav service",
|
||||
Before: func(c *cli.Context) error {
|
||||
if err := loadUserAgent(c, cfg); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
// TODO: check
|
||||
//Before: func(c *cli.Context) error {
|
||||
// if err := loadUserAgent(c, cfg); err != nil {
|
||||
// return err
|
||||
// }
|
||||
// return nil
|
||||
//},
|
||||
Before: func(ctx *cli.Context) error {
|
||||
return parser.ParseConfig(cfg)
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
logCfg := cfg.Logging
|
||||
@@ -59,8 +64,8 @@ func OCDav(cfg *config.Config) *cli.Command {
|
||||
ocdav.Insecure(cfg.Insecure),
|
||||
ocdav.PublicURL(cfg.PublicURL),
|
||||
ocdav.Prefix(cfg.HTTP.Prefix),
|
||||
ocdav.GatewaySvc(cfg.GatewayEndpoint),
|
||||
ocdav.JWTSecret(cfg.JWTSecret),
|
||||
ocdav.GatewaySvc(cfg.Reva.Address),
|
||||
ocdav.JWTSecret(cfg.TokenManager.JWTSecret),
|
||||
// ocdav.FavoriteManager() // FIXME needs a proper persistence implementation
|
||||
// ocdav.LockSystem(), // will default to the CS3 lock system
|
||||
// ocdav.TLSConfig() // tls config for the http server
|
||||
|
||||
@@ -12,10 +12,10 @@ type Config struct {
|
||||
|
||||
HTTP HTTPConfig `yaml:"http,omitempty"`
|
||||
|
||||
// JWTSecret used to verify reva access token
|
||||
JWTSecret string `yaml:"jwt_secret"`
|
||||
GatewayEndpoint string `yaml:"gateway_endpoint,omitempty"`
|
||||
SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token,omitempty"`
|
||||
TokenManager *TokenManager `yaml:"token_manager,omitempty"`
|
||||
Reva *Reva `yaml:"reva,omitempty"`
|
||||
|
||||
SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token,omitempty"`
|
||||
|
||||
WebdavNamespace string `yaml:"webdav_namespace,omitempty"`
|
||||
FilesNamespace string `yaml:"files_namespace,omitempty"`
|
||||
|
||||
@@ -28,8 +28,9 @@ func DefaultConfig() *config.Config {
|
||||
Service: config.Service{
|
||||
Name: "ocdav",
|
||||
},
|
||||
GatewayEndpoint: "127.0.0.1:9142",
|
||||
JWTSecret: "Pive-Fumkiu4",
|
||||
Reva: &config.Reva{
|
||||
Address: "127.0.0.1:9142",
|
||||
},
|
||||
WebdavNamespace: "/users/{{.Id.OpaqueId}}",
|
||||
FilesNamespace: "/users/{{.Id.OpaqueId}}",
|
||||
SharesNamespace: "/Shares",
|
||||
@@ -67,6 +68,22 @@ func EnsureDefaults(cfg *config.Config) {
|
||||
} else if cfg.Tracing == nil {
|
||||
cfg.Tracing = &config.Tracing{}
|
||||
}
|
||||
|
||||
if cfg.Reva == nil && cfg.Commons != nil && cfg.Commons.Reva != nil {
|
||||
cfg.Reva = &config.Reva{
|
||||
Address: cfg.Commons.Reva.Address,
|
||||
}
|
||||
} else if cfg.Reva == nil {
|
||||
cfg.Reva = &config.Reva{}
|
||||
}
|
||||
|
||||
if cfg.TokenManager == nil && cfg.Commons != nil && cfg.Commons.TokenManager != nil {
|
||||
cfg.TokenManager = &config.TokenManager{
|
||||
JWTSecret: cfg.Commons.TokenManager.JWTSecret,
|
||||
}
|
||||
} else if cfg.TokenManager == nil {
|
||||
cfg.TokenManager = &config.TokenManager{}
|
||||
}
|
||||
}
|
||||
|
||||
func Sanitize(cfg *config.Config) {
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package parser
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/owncloud/ocis/extensions/ocdav/pkg/config"
|
||||
"github.com/owncloud/ocis/extensions/ocdav/pkg/config/defaults"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/config/envdecode"
|
||||
)
|
||||
|
||||
// ParseConfig loads accounts configuration from known paths.
|
||||
func ParseConfig(cfg *config.Config) error {
|
||||
_, err := ociscfg.BindSourcesToStructs(cfg.Service.Name, cfg)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
defaults.EnsureDefaults(cfg)
|
||||
|
||||
// load all env variables relevant to the config in the current context.
|
||||
if err := envdecode.Decode(cfg); err != nil {
|
||||
// no environment variable set for this config is an expected "error"
|
||||
if !errors.Is(err, envdecode.ErrNoTargetFieldsAreSet) {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
defaults.Sanitize(cfg)
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package config
|
||||
|
||||
// Reva defines all available REVA configuration.
|
||||
type Reva struct {
|
||||
Address string `yaml:"address" env:"REVA_GATEWAY"`
|
||||
}
|
||||
|
||||
// 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"`
|
||||
}
|
||||
@@ -19,7 +19,7 @@ type Config struct {
|
||||
HTTP HTTP `yaml:"http,omitempty"`
|
||||
|
||||
TokenManager *TokenManager `yaml:"token_manager,omitempty"`
|
||||
Reva Reva `yaml:"reva,omitempty"`
|
||||
Reva *Reva `yaml:"reva,omitempty"`
|
||||
|
||||
IdentityManagement IdentityManagement `yaml:"identity_management,omitempty"`
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ func DefaultConfig() *config.Config {
|
||||
},
|
||||
|
||||
AccountBackend: "accounts",
|
||||
Reva: config.Reva{
|
||||
Reva: &config.Reva{
|
||||
Address: "127.0.0.1:9142",
|
||||
},
|
||||
StorageUsersDriver: "ocis",
|
||||
@@ -74,11 +74,19 @@ func EnsureDefaults(cfg *config.Config) {
|
||||
cfg.Tracing = &config.Tracing{}
|
||||
}
|
||||
|
||||
if cfg.Reva == nil && cfg.Commons != nil && cfg.Commons.Reva != nil {
|
||||
cfg.Reva = &config.Reva{
|
||||
Address: cfg.Commons.Reva.Address,
|
||||
}
|
||||
} else if cfg.Reva == nil {
|
||||
cfg.Reva = &config.Reva{}
|
||||
}
|
||||
|
||||
if cfg.TokenManager == nil && cfg.Commons != nil && cfg.Commons.TokenManager != nil {
|
||||
cfg.TokenManager = &config.TokenManager{
|
||||
JWTSecret: cfg.Commons.TokenManager.JWTSecret,
|
||||
}
|
||||
} else {
|
||||
} else if cfg.TokenManager == nil {
|
||||
cfg.TokenManager = &config.TokenManager{}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ type Config struct {
|
||||
|
||||
HTTP HTTP `yaml:"http,omitempty"`
|
||||
|
||||
Reva Reva `yaml:"reva,omitempty"`
|
||||
Reva *Reva `yaml:"reva,omitempty"`
|
||||
|
||||
Policies []Policy `yaml:"policies,omitempty"`
|
||||
OIDC OIDC `yaml:"oidc,omitempty"`
|
||||
|
||||
@@ -36,7 +36,7 @@ func DefaultConfig() *config.Config {
|
||||
},
|
||||
},
|
||||
PolicySelector: nil,
|
||||
Reva: config.Reva{
|
||||
Reva: &config.Reva{
|
||||
Address: "127.0.0.1:9142",
|
||||
},
|
||||
PreSignedURL: config.PreSignedURL{
|
||||
@@ -182,7 +182,7 @@ func EnsureDefaults(cfg *config.Config) {
|
||||
cfg.TokenManager = &config.TokenManager{
|
||||
JWTSecret: cfg.Commons.TokenManager.JWTSecret,
|
||||
}
|
||||
} else {
|
||||
} else if cfg.TokenManager == nil {
|
||||
cfg.TokenManager = &config.TokenManager{}
|
||||
}
|
||||
|
||||
@@ -191,6 +191,22 @@ func EnsureDefaults(cfg *config.Config) {
|
||||
} else {
|
||||
log.Fatalf("machine auth api key is not set up properly, bailing out (%s)", cfg.Service.Name)
|
||||
}
|
||||
|
||||
if cfg.Reva == nil && cfg.Commons != nil && cfg.Commons.Reva != nil {
|
||||
cfg.Reva = &config.Reva{
|
||||
Address: cfg.Commons.Reva.Address,
|
||||
}
|
||||
} else if cfg.Reva == nil {
|
||||
cfg.Reva = &config.Reva{}
|
||||
}
|
||||
|
||||
if cfg.TokenManager == nil && cfg.Commons != nil && cfg.Commons.TokenManager != nil {
|
||||
cfg.TokenManager = &config.TokenManager{
|
||||
JWTSecret: cfg.Commons.TokenManager.JWTSecret,
|
||||
}
|
||||
} else if cfg.TokenManager == nil {
|
||||
cfg.TokenManager = &config.TokenManager{}
|
||||
}
|
||||
}
|
||||
|
||||
func Sanitize(cfg *config.Config) {
|
||||
|
||||
@@ -89,7 +89,7 @@ func EnsureDefaults(cfg *config.Config) {
|
||||
cfg.TokenManager = &config.TokenManager{
|
||||
JWTSecret: cfg.Commons.TokenManager.JWTSecret,
|
||||
}
|
||||
} else {
|
||||
} else if cfg.TokenManager == nil {
|
||||
cfg.TokenManager = &config.TokenManager{}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import (
|
||||
"github.com/gofrs/uuid"
|
||||
"github.com/oklog/run"
|
||||
"github.com/owncloud/ocis/extensions/sharing/pkg/config"
|
||||
"github.com/owncloud/ocis/extensions/sharing/pkg/config/parser"
|
||||
"github.com/owncloud/ocis/extensions/storage/pkg/server/debug"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/thejerf/suture/v4"
|
||||
@@ -26,6 +27,9 @@ func Sharing(cfg *config.Config) *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "sharing",
|
||||
Usage: "start sharing service",
|
||||
Before: func(ctx *cli.Context) error {
|
||||
return parser.ParseConfig(cfg)
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
logCfg := cfg.Logging
|
||||
logger := log.NewLogger(
|
||||
@@ -109,8 +113,8 @@ func sharingConfigFromStruct(c *cli.Context, cfg *config.Config) map[string]inte
|
||||
"tracing_service_name": c.Command.Name,
|
||||
},
|
||||
"shared": map[string]interface{}{
|
||||
"jwt_secret": cfg.JWTSecret,
|
||||
"gatewaysvc": cfg.GatewayEndpoint,
|
||||
"jwt_secret": cfg.TokenManager.JWTSecret,
|
||||
"gatewaysvc": cfg.Reva.Address,
|
||||
"skip_user_groups_in_token": cfg.SkipUserGroupsInToken,
|
||||
},
|
||||
"grpc": map[string]interface{}{
|
||||
@@ -123,7 +127,7 @@ func sharingConfigFromStruct(c *cli.Context, cfg *config.Config) map[string]inte
|
||||
"drivers": map[string]interface{}{
|
||||
"json": map[string]interface{}{
|
||||
"file": cfg.UserSharingDrivers.JSON.File,
|
||||
"gateway_addr": cfg.GatewayEndpoint,
|
||||
"gateway_addr": cfg.Reva.Address,
|
||||
},
|
||||
"sql": map[string]interface{}{ // cernbox sql
|
||||
"db_username": cfg.UserSharingDrivers.SQL.DBUsername,
|
||||
@@ -156,7 +160,7 @@ func sharingConfigFromStruct(c *cli.Context, cfg *config.Config) map[string]inte
|
||||
"drivers": map[string]interface{}{
|
||||
"json": map[string]interface{}{
|
||||
"file": cfg.PublicSharingDrivers.JSON.File,
|
||||
"gateway_addr": cfg.GatewayEndpoint,
|
||||
"gateway_addr": cfg.Reva.Address,
|
||||
},
|
||||
"sql": map[string]interface{}{
|
||||
"db_username": cfg.PublicSharingDrivers.SQL.DBUsername,
|
||||
|
||||
@@ -12,8 +12,9 @@ type Config struct {
|
||||
|
||||
GRPC GRPCConfig `yaml:"grpc,omitempty"`
|
||||
|
||||
JWTSecret string `yaml:"jwt_secret,omitempty"`
|
||||
GatewayEndpoint string `yaml:"gateway_endpoint,omitempty"`
|
||||
TokenManager *TokenManager `yaml:"token_manager,omitempty"`
|
||||
Reva *Reva `yaml:"reva,omitempty"`
|
||||
|
||||
SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token,omitempty"`
|
||||
UserSharingDriver string `yaml:"user_sharing_driver,omitempty"`
|
||||
UserSharingDrivers UserSharingDrivers `yaml:"user_sharin_drivers,omitempty"`
|
||||
|
||||
@@ -30,8 +30,9 @@ func DefaultConfig() *config.Config {
|
||||
Service: config.Service{
|
||||
Name: "sharing",
|
||||
},
|
||||
GatewayEndpoint: "127.0.0.1:9142",
|
||||
JWTSecret: "Pive-Fumkiu4",
|
||||
Reva: &config.Reva{
|
||||
Address: "127.0.0.1:9142",
|
||||
},
|
||||
UserSharingDriver: "json",
|
||||
UserSharingDrivers: config.UserSharingDrivers{
|
||||
JSON: config.UserSharingJSONDriver{
|
||||
@@ -104,6 +105,22 @@ func EnsureDefaults(cfg *config.Config) {
|
||||
} else if cfg.Tracing == nil {
|
||||
cfg.Tracing = &config.Tracing{}
|
||||
}
|
||||
|
||||
if cfg.Reva == nil && cfg.Commons != nil && cfg.Commons.Reva != nil {
|
||||
cfg.Reva = &config.Reva{
|
||||
Address: cfg.Commons.Reva.Address,
|
||||
}
|
||||
} else if cfg.Reva == nil {
|
||||
cfg.Reva = &config.Reva{}
|
||||
}
|
||||
|
||||
if cfg.TokenManager == nil && cfg.Commons != nil && cfg.Commons.TokenManager != nil {
|
||||
cfg.TokenManager = &config.TokenManager{
|
||||
JWTSecret: cfg.Commons.TokenManager.JWTSecret,
|
||||
}
|
||||
} else if cfg.TokenManager == nil {
|
||||
cfg.TokenManager = &config.TokenManager{}
|
||||
}
|
||||
}
|
||||
|
||||
func Sanitize(cfg *config.Config) {
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package parser
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/owncloud/ocis/extensions/sharing/pkg/config"
|
||||
"github.com/owncloud/ocis/extensions/sharing/pkg/config/defaults"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/config/envdecode"
|
||||
)
|
||||
|
||||
// ParseConfig loads accounts configuration from known paths.
|
||||
func ParseConfig(cfg *config.Config) error {
|
||||
_, err := ociscfg.BindSourcesToStructs(cfg.Service.Name, cfg)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
defaults.EnsureDefaults(cfg)
|
||||
|
||||
// load all env variables relevant to the config in the current context.
|
||||
if err := envdecode.Decode(cfg); err != nil {
|
||||
// no environment variable set for this config is an expected "error"
|
||||
if !errors.Is(err, envdecode.ErrNoTargetFieldsAreSet) {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
defaults.Sanitize(cfg)
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package config
|
||||
|
||||
// Reva defines all available REVA configuration.
|
||||
type Reva struct {
|
||||
Address string `yaml:"address" env:"REVA_GATEWAY"`
|
||||
}
|
||||
|
||||
// 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"`
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"os"
|
||||
"path"
|
||||
|
||||
"github.com/owncloud/ocis/extensions/storage-metadata/pkg/config/parser"
|
||||
"github.com/owncloud/ocis/ocis-pkg/log"
|
||||
"github.com/owncloud/ocis/ocis-pkg/sync"
|
||||
"github.com/owncloud/ocis/ocis-pkg/tracing"
|
||||
@@ -30,6 +31,9 @@ func StorageMetadata(cfg *config.Config) *cli.Command {
|
||||
Name: "storage-metadata",
|
||||
Usage: "start storage-metadata service",
|
||||
Category: "extensions",
|
||||
Before: func(ctx *cli.Context) error {
|
||||
return parser.ParseConfig(cfg)
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
logCfg := cfg.Logging
|
||||
logger := log.NewLogger(
|
||||
@@ -124,8 +128,8 @@ func storageMetadataFromStruct(c *cli.Context, cfg *config.Config) map[string]in
|
||||
"tracing_service_name": c.Command.Name,
|
||||
},
|
||||
"shared": map[string]interface{}{
|
||||
"jwt_secret": cfg.JWTSecret,
|
||||
"gatewaysvc": cfg.GatewayEndpoint,
|
||||
"jwt_secret": cfg.TokenManager.JWTSecret,
|
||||
"gatewaysvc": cfg.Reva.Address,
|
||||
"skip_user_groups_in_token": cfg.SkipUserGroupsInToken,
|
||||
},
|
||||
"grpc": map[string]interface{}{
|
||||
|
||||
@@ -17,15 +17,17 @@ type Config struct {
|
||||
GRPC GRPCConfig `yaml:"grpc,omitempty"`
|
||||
HTTP HTTPConfig `yaml:"http,omitempty"`
|
||||
|
||||
Context context.Context `yaml:"context,omitempty"`
|
||||
JWTSecret string `yaml:"jwt_secret,omitempty"`
|
||||
GatewayEndpoint string `yaml:"gateway_endpoint,omitempty"`
|
||||
SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token,omitempty"`
|
||||
Driver string `yaml:"driver,omitempty" env:"STORAGE_METADATA_DRIVER" desc:"The driver which should be used by the service"`
|
||||
Drivers Drivers `yaml:"drivers,omitempty"`
|
||||
DataServerURL string `yaml:"data_server_url,omitempty"`
|
||||
TempFolder string `yaml:"temp_folder,omitempty"`
|
||||
DataProviderInsecure bool `yaml:"data_providcer_insecure,omitempty" env:"OCIS_INSECURE;STORAGE_METADATA_DATAPROVIDER_INSECURE"`
|
||||
Context context.Context `yaml:"context,omitempty"`
|
||||
|
||||
TokenManager *TokenManager `yaml:"token_manager,omitempty"`
|
||||
Reva *Reva `yaml:"reva,omitempty"`
|
||||
|
||||
SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token,omitempty"`
|
||||
Driver string `yaml:"driver,omitempty" env:"STORAGE_METADATA_DRIVER" desc:"The driver which should be used by the service"`
|
||||
Drivers Drivers `yaml:"drivers,omitempty"`
|
||||
DataServerURL string `yaml:"data_server_url,omitempty"`
|
||||
TempFolder string `yaml:"temp_folder,omitempty"`
|
||||
DataProviderInsecure bool `yaml:"data_providcer_insecure,omitempty" env:"OCIS_INSECURE;STORAGE_METADATA_DATAPROVIDER_INSECURE"`
|
||||
}
|
||||
type Tracing struct {
|
||||
Enabled bool `yaml:"enabled" env:"OCIS_TRACING_ENABLED;STORAGE_METADATA_TRACING_ENABLED" desc:"Activates tracing."`
|
||||
|
||||
@@ -35,11 +35,12 @@ func DefaultConfig() *config.Config {
|
||||
Service: config.Service{
|
||||
Name: "storage-metadata",
|
||||
},
|
||||
GatewayEndpoint: "127.0.0.1:9142",
|
||||
JWTSecret: "Pive-Fumkiu4",
|
||||
TempFolder: filepath.Join(defaults.BaseDataPath(), "tmp", "metadata"),
|
||||
DataServerURL: "http://localhost:9216/data",
|
||||
Driver: "ocis",
|
||||
Reva: &config.Reva{
|
||||
Address: "127.0.0.1:9142",
|
||||
},
|
||||
TempFolder: filepath.Join(defaults.BaseDataPath(), "tmp", "metadata"),
|
||||
DataServerURL: "http://localhost:9216/data",
|
||||
Driver: "ocis",
|
||||
Drivers: config.Drivers{
|
||||
EOS: config.EOSDriver{
|
||||
Root: "/eos/dockertest/reva",
|
||||
@@ -105,6 +106,22 @@ func EnsureDefaults(cfg *config.Config) {
|
||||
} else if cfg.Tracing == nil {
|
||||
cfg.Tracing = &config.Tracing{}
|
||||
}
|
||||
|
||||
if cfg.Reva == nil && cfg.Commons != nil && cfg.Commons.Reva != nil {
|
||||
cfg.Reva = &config.Reva{
|
||||
Address: cfg.Commons.Reva.Address,
|
||||
}
|
||||
} else if cfg.Reva == nil {
|
||||
cfg.Reva = &config.Reva{}
|
||||
}
|
||||
|
||||
if cfg.TokenManager == nil && cfg.Commons != nil && cfg.Commons.TokenManager != nil {
|
||||
cfg.TokenManager = &config.TokenManager{
|
||||
JWTSecret: cfg.Commons.TokenManager.JWTSecret,
|
||||
}
|
||||
} else if cfg.TokenManager == nil {
|
||||
cfg.TokenManager = &config.TokenManager{}
|
||||
}
|
||||
}
|
||||
|
||||
func Sanitize(cfg *config.Config) {
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package parser
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/owncloud/ocis/extensions/storage-metadata/pkg/config"
|
||||
"github.com/owncloud/ocis/extensions/storage-metadata/pkg/config/defaults"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/config/envdecode"
|
||||
)
|
||||
|
||||
// ParseConfig loads accounts configuration from known paths.
|
||||
func ParseConfig(cfg *config.Config) error {
|
||||
_, err := ociscfg.BindSourcesToStructs(cfg.Service.Name, cfg)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
defaults.EnsureDefaults(cfg)
|
||||
|
||||
// load all env variables relevant to the config in the current context.
|
||||
if err := envdecode.Decode(cfg); err != nil {
|
||||
// no environment variable set for this config is an expected "error"
|
||||
if !errors.Is(err, envdecode.ErrNoTargetFieldsAreSet) {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
defaults.Sanitize(cfg)
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package config
|
||||
|
||||
// Reva defines all available REVA configuration.
|
||||
type Reva struct {
|
||||
Address string `yaml:"address" env:"REVA_GATEWAY"`
|
||||
}
|
||||
|
||||
// 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"`
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
"github.com/gofrs/uuid"
|
||||
"github.com/oklog/run"
|
||||
"github.com/owncloud/ocis/extensions/storage-publiclink/pkg/config"
|
||||
"github.com/owncloud/ocis/extensions/storage-publiclink/pkg/config/parser"
|
||||
"github.com/owncloud/ocis/extensions/storage/pkg/server/debug"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/log"
|
||||
@@ -25,6 +26,9 @@ func StoragePublicLink(cfg *config.Config) *cli.Command {
|
||||
Name: "storage-public-link",
|
||||
Usage: "start storage-public-link service",
|
||||
Category: "extensions",
|
||||
Before: func(ctx *cli.Context) error {
|
||||
return parser.ParseConfig(cfg)
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
logCfg := cfg.Logging
|
||||
logger := log.NewLogger(
|
||||
@@ -94,8 +98,8 @@ func storagePublicLinkConfigFromStruct(c *cli.Context, cfg *config.Config) map[s
|
||||
"tracing_service_name": c.Command.Name,
|
||||
},
|
||||
"shared": map[string]interface{}{
|
||||
"jwt_secret": cfg.JWTSecret,
|
||||
"gatewaysvc": cfg.GatewayEndpoint,
|
||||
"jwt_secret": cfg.TokenManager.JWTSecret,
|
||||
"gatewaysvc": cfg.Reva.Address,
|
||||
"skip_user_groups_in_token": cfg.SkipUserGroupsInToken,
|
||||
},
|
||||
"grpc": map[string]interface{}{
|
||||
|
||||
@@ -16,9 +16,11 @@ type Config struct {
|
||||
|
||||
GRPC GRPCConfig `yaml:"grpc,omitempty"`
|
||||
|
||||
Context context.Context `yaml:"context,omitempty"`
|
||||
JWTSecret string `yaml:"jwt_secret,omitempty"`
|
||||
GatewayEndpoint string `yaml:"gateway_endpoint,omitempty"`
|
||||
Context context.Context `yaml:"context,omitempty"`
|
||||
|
||||
TokenManager *TokenManager `yaml:"token_manager,omitempty"`
|
||||
Reva *Reva `yaml:"reva,omitempty"`
|
||||
|
||||
SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token,omitempty"`
|
||||
AuthProvider AuthProvider `yaml:"auth_provider,omitempty"`
|
||||
StorageProvider StorageProvider `yaml:"storage_provider,omitempty"`
|
||||
|
||||
@@ -27,8 +27,9 @@ func DefaultConfig() *config.Config {
|
||||
Service: config.Service{
|
||||
Name: "storage-publiclink",
|
||||
},
|
||||
GatewayEndpoint: "127.0.0.1:9142",
|
||||
JWTSecret: "Pive-Fumkiu4",
|
||||
Reva: &config.Reva{
|
||||
Address: "127.0.0.1:9142",
|
||||
},
|
||||
AuthProvider: config.AuthProvider{
|
||||
GatewayEndpoint: "127.0.0.1:9142",
|
||||
},
|
||||
@@ -62,6 +63,22 @@ func EnsureDefaults(cfg *config.Config) {
|
||||
} else if cfg.Tracing == nil {
|
||||
cfg.Tracing = &config.Tracing{}
|
||||
}
|
||||
|
||||
if cfg.Reva == nil && cfg.Commons != nil && cfg.Commons.Reva != nil {
|
||||
cfg.Reva = &config.Reva{
|
||||
Address: cfg.Commons.Reva.Address,
|
||||
}
|
||||
} else if cfg.Reva == nil {
|
||||
cfg.Reva = &config.Reva{}
|
||||
}
|
||||
|
||||
if cfg.TokenManager == nil && cfg.Commons != nil && cfg.Commons.TokenManager != nil {
|
||||
cfg.TokenManager = &config.TokenManager{
|
||||
JWTSecret: cfg.Commons.TokenManager.JWTSecret,
|
||||
}
|
||||
} else if cfg.TokenManager == nil {
|
||||
cfg.TokenManager = &config.TokenManager{}
|
||||
}
|
||||
}
|
||||
|
||||
func Sanitize(cfg *config.Config) {
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package parser
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/owncloud/ocis/extensions/storage-publiclink/pkg/config"
|
||||
"github.com/owncloud/ocis/extensions/storage-publiclink/pkg/config/defaults"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/config/envdecode"
|
||||
)
|
||||
|
||||
// ParseConfig loads accounts configuration from known paths.
|
||||
func ParseConfig(cfg *config.Config) error {
|
||||
_, err := ociscfg.BindSourcesToStructs(cfg.Service.Name, cfg)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
defaults.EnsureDefaults(cfg)
|
||||
|
||||
// load all env variables relevant to the config in the current context.
|
||||
if err := envdecode.Decode(cfg); err != nil {
|
||||
// no environment variable set for this config is an expected "error"
|
||||
if !errors.Is(err, envdecode.ErrNoTargetFieldsAreSet) {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
defaults.Sanitize(cfg)
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package config
|
||||
|
||||
// Reva defines all available REVA configuration.
|
||||
type Reva struct {
|
||||
Address string `yaml:"address" env:"REVA_GATEWAY"`
|
||||
}
|
||||
|
||||
// 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"`
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import (
|
||||
"github.com/gofrs/uuid"
|
||||
"github.com/oklog/run"
|
||||
"github.com/owncloud/ocis/extensions/storage-shares/pkg/config"
|
||||
"github.com/owncloud/ocis/extensions/storage-shares/pkg/config/parser"
|
||||
"github.com/owncloud/ocis/extensions/storage/pkg/server/debug"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/thejerf/suture/v4"
|
||||
@@ -25,6 +26,9 @@ func StorageShares(cfg *config.Config) *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "storage-shares",
|
||||
Usage: "start storage-shares service",
|
||||
Before: func(ctx *cli.Context) error {
|
||||
return parser.ParseConfig(cfg)
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
logCfg := cfg.Logging
|
||||
logger := log.NewLogger(
|
||||
@@ -96,8 +100,8 @@ func storageSharesConfigFromStruct(c *cli.Context, cfg *config.Config) map[strin
|
||||
"tracing_service_name": c.Command.Name,
|
||||
},
|
||||
"shared": map[string]interface{}{
|
||||
"jwt_secret": cfg.JWTSecret,
|
||||
"gatewaysvc": cfg.GatewayEndpoint,
|
||||
"jwt_secret": cfg.TokenManager.JWTSecret,
|
||||
"gatewaysvc": cfg.Reva.Address,
|
||||
"skip_user_groups_in_token": cfg.SkipUserGroupsInToken,
|
||||
},
|
||||
"grpc": map[string]interface{}{
|
||||
|
||||
@@ -17,9 +17,10 @@ type Config struct {
|
||||
GRPC GRPCConfig `yaml:"grpc,omitempty"`
|
||||
HTTP HTTPConfig `yaml:"http,omitempty"`
|
||||
|
||||
TokenManager *TokenManager `yaml:"token_manager,omitempty"`
|
||||
Reva *Reva `yaml:"reva,omitempty"`
|
||||
|
||||
Context context.Context `yaml:"context,omitempty"`
|
||||
JWTSecret string `yaml:"jwt_secret,omitempty"`
|
||||
GatewayEndpoint string `yaml:"gateway_endpoint,omitempty"`
|
||||
SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token,omitempty"`
|
||||
ReadOnly bool `yaml:"readonly,omitempty"`
|
||||
SharesProviderEndpoint string `yaml:"shares_provider_endpoint,omitempty"`
|
||||
|
||||
@@ -31,8 +31,9 @@ func DefaultConfig() *config.Config {
|
||||
Service: config.Service{
|
||||
Name: "storage-metadata",
|
||||
},
|
||||
GatewayEndpoint: "127.0.0.1:9142",
|
||||
JWTSecret: "Pive-Fumkiu4",
|
||||
Reva: &config.Reva{
|
||||
Address: "127.0.0.1:9142",
|
||||
},
|
||||
ReadOnly: false,
|
||||
SharesProviderEndpoint: "localhost:9150",
|
||||
}
|
||||
@@ -61,6 +62,22 @@ func EnsureDefaults(cfg *config.Config) {
|
||||
} else if cfg.Tracing == nil {
|
||||
cfg.Tracing = &config.Tracing{}
|
||||
}
|
||||
|
||||
if cfg.Reva == nil && cfg.Commons != nil && cfg.Commons.Reva != nil {
|
||||
cfg.Reva = &config.Reva{
|
||||
Address: cfg.Commons.Reva.Address,
|
||||
}
|
||||
} else if cfg.Reva == nil {
|
||||
cfg.Reva = &config.Reva{}
|
||||
}
|
||||
|
||||
if cfg.TokenManager == nil && cfg.Commons != nil && cfg.Commons.TokenManager != nil {
|
||||
cfg.TokenManager = &config.TokenManager{
|
||||
JWTSecret: cfg.Commons.TokenManager.JWTSecret,
|
||||
}
|
||||
} else if cfg.TokenManager == nil {
|
||||
cfg.TokenManager = &config.TokenManager{}
|
||||
}
|
||||
}
|
||||
|
||||
func Sanitize(cfg *config.Config) {
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package parser
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/owncloud/ocis/extensions/storage-shares/pkg/config"
|
||||
"github.com/owncloud/ocis/extensions/storage-shares/pkg/config/defaults"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/config/envdecode"
|
||||
)
|
||||
|
||||
// ParseConfig loads accounts configuration from known paths.
|
||||
func ParseConfig(cfg *config.Config) error {
|
||||
_, err := ociscfg.BindSourcesToStructs(cfg.Service.Name, cfg)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
defaults.EnsureDefaults(cfg)
|
||||
|
||||
// load all env variables relevant to the config in the current context.
|
||||
if err := envdecode.Decode(cfg); err != nil {
|
||||
// no environment variable set for this config is an expected "error"
|
||||
if !errors.Is(err, envdecode.ErrNoTargetFieldsAreSet) {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
defaults.Sanitize(cfg)
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package config
|
||||
|
||||
// Reva defines all available REVA configuration.
|
||||
type Reva struct {
|
||||
Address string `yaml:"address" env:"REVA_GATEWAY"`
|
||||
}
|
||||
|
||||
// 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"`
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
"github.com/gofrs/uuid"
|
||||
"github.com/oklog/run"
|
||||
"github.com/owncloud/ocis/extensions/storage-users/pkg/config"
|
||||
"github.com/owncloud/ocis/extensions/storage-users/pkg/config/parser"
|
||||
"github.com/owncloud/ocis/extensions/storage/pkg/server/debug"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/log"
|
||||
@@ -24,6 +25,9 @@ func StorageUsers(cfg *config.Config) *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "storage-users",
|
||||
Usage: "start storage-users service",
|
||||
Before: func(ctx *cli.Context) error {
|
||||
return parser.ParseConfig(cfg)
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
logCfg := cfg.Logging
|
||||
logger := log.NewLogger(
|
||||
@@ -95,8 +99,8 @@ func storageUsersConfigFromStruct(c *cli.Context, cfg *config.Config) map[string
|
||||
"tracing_service_name": c.Command.Name,
|
||||
},
|
||||
"shared": map[string]interface{}{
|
||||
"jwt_secret": cfg.JWTSecret,
|
||||
"gatewaysvc": cfg.GatewayEndpoint,
|
||||
"jwt_secret": cfg.TokenManager.JWTSecret,
|
||||
"gatewaysvc": cfg.Reva.Address,
|
||||
"skip_user_groups_in_token": cfg.SkipUserGroupsInToken,
|
||||
},
|
||||
"grpc": map[string]interface{}{
|
||||
|
||||
@@ -17,19 +17,21 @@ type Config struct {
|
||||
GRPC GRPCConfig `yaml:"grpc,omitempty"`
|
||||
HTTP HTTPConfig `yaml:"http,omitempty"`
|
||||
|
||||
Context context.Context `yaml:"context,omitempty"`
|
||||
JWTSecret string `yaml:"jwt_secret,omitempty"`
|
||||
GatewayEndpoint string `yaml:"gateway_endpoint,omitempty"`
|
||||
SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token,omitempty"`
|
||||
Driver string `yaml:"driver,omitempty" env:"STORAGE_USERS_DRIVER" desc:"The storage driver which should be used by the service"`
|
||||
Drivers Drivers `yaml:"drivers,omitempty"`
|
||||
DataServerURL string `yaml:"data_server_url,omitempty"`
|
||||
TempFolder string `yaml:"temp_folder,omitempty"`
|
||||
DataProviderInsecure bool `yaml:"data_provider_insecure,omitempty" env:"OCIS_INSECURE;STORAGE_USERS_DATAPROVIDER_INSECURE"`
|
||||
Events Events `yaml:"events,omitempty"`
|
||||
MountID string `yaml:"mount_id,omitempty"`
|
||||
ExposeDataServer bool `yaml:"expose_data_server,omitempty"`
|
||||
ReadOnly bool `yaml:"readonly,omitempty"`
|
||||
TokenManager *TokenManager `yaml:"token_manager,omitempty"`
|
||||
Reva *Reva `yaml:"reva,omitempty"`
|
||||
|
||||
Context context.Context `yaml:"context,omitempty"`
|
||||
|
||||
SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token,omitempty"`
|
||||
Driver string `yaml:"driver,omitempty" env:"STORAGE_USERS_DRIVER" desc:"The storage driver which should be used by the service"`
|
||||
Drivers Drivers `yaml:"drivers,omitempty"`
|
||||
DataServerURL string `yaml:"data_server_url,omitempty"`
|
||||
TempFolder string `yaml:"temp_folder,omitempty"`
|
||||
DataProviderInsecure bool `yaml:"data_provider_insecure,omitempty" env:"OCIS_INSECURE;STORAGE_USERS_DATAPROVIDER_INSECURE"`
|
||||
Events Events `yaml:"events,omitempty"`
|
||||
MountID string `yaml:"mount_id,omitempty"`
|
||||
ExposeDataServer bool `yaml:"expose_data_server,omitempty"`
|
||||
ReadOnly bool `yaml:"readonly,omitempty"`
|
||||
}
|
||||
type Tracing struct {
|
||||
Enabled bool `yaml:"enabled" env:"OCIS_TRACING_ENABLED;STORAGE_USERS_TRACING_ENABLED" desc:"Activates tracing."`
|
||||
|
||||
@@ -36,12 +36,13 @@ func DefaultConfig() *config.Config {
|
||||
Service: config.Service{
|
||||
Name: "storage-users",
|
||||
},
|
||||
GatewayEndpoint: "127.0.0.1:9142",
|
||||
JWTSecret: "Pive-Fumkiu4",
|
||||
TempFolder: filepath.Join(defaults.BaseDataPath(), "tmp", "users"),
|
||||
DataServerURL: "http://localhost:9158/data",
|
||||
MountID: "1284d238-aa92-42ce-bdc4-0b0000009157",
|
||||
Driver: "ocis",
|
||||
Reva: &config.Reva{
|
||||
Address: "127.0.0.1:9142",
|
||||
},
|
||||
TempFolder: filepath.Join(defaults.BaseDataPath(), "tmp", "users"),
|
||||
DataServerURL: "http://localhost:9158/data",
|
||||
MountID: "1284d238-aa92-42ce-bdc4-0b0000009157",
|
||||
Driver: "ocis",
|
||||
Drivers: config.Drivers{
|
||||
EOS: config.EOSDriver{
|
||||
Root: "/eos/dockertest/reva",
|
||||
@@ -124,6 +125,22 @@ func EnsureDefaults(cfg *config.Config) {
|
||||
} else if cfg.Tracing == nil {
|
||||
cfg.Tracing = &config.Tracing{}
|
||||
}
|
||||
|
||||
if cfg.Reva == nil && cfg.Commons != nil && cfg.Commons.Reva != nil {
|
||||
cfg.Reva = &config.Reva{
|
||||
Address: cfg.Commons.Reva.Address,
|
||||
}
|
||||
} else if cfg.Reva == nil {
|
||||
cfg.Reva = &config.Reva{}
|
||||
}
|
||||
|
||||
if cfg.TokenManager == nil && cfg.Commons != nil && cfg.Commons.TokenManager != nil {
|
||||
cfg.TokenManager = &config.TokenManager{
|
||||
JWTSecret: cfg.Commons.TokenManager.JWTSecret,
|
||||
}
|
||||
} else if cfg.TokenManager == nil {
|
||||
cfg.TokenManager = &config.TokenManager{}
|
||||
}
|
||||
}
|
||||
|
||||
func Sanitize(cfg *config.Config) {
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package parser
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/owncloud/ocis/extensions/storage-users/pkg/config"
|
||||
"github.com/owncloud/ocis/extensions/storage-users/pkg/config/defaults"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/config/envdecode"
|
||||
)
|
||||
|
||||
// ParseConfig loads accounts configuration from known paths.
|
||||
func ParseConfig(cfg *config.Config) error {
|
||||
_, err := ociscfg.BindSourcesToStructs(cfg.Service.Name, cfg)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
defaults.EnsureDefaults(cfg)
|
||||
|
||||
// load all env variables relevant to the config in the current context.
|
||||
if err := envdecode.Decode(cfg); err != nil {
|
||||
// no environment variable set for this config is an expected "error"
|
||||
if !errors.Is(err, envdecode.ErrNoTargetFieldsAreSet) {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
defaults.Sanitize(cfg)
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package config
|
||||
|
||||
// Reva defines all available REVA configuration.
|
||||
type Reva struct {
|
||||
Address string `yaml:"address" env:"REVA_GATEWAY"`
|
||||
}
|
||||
|
||||
// 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"`
|
||||
}
|
||||
@@ -35,7 +35,7 @@ func DefaultConfig() *config.Config {
|
||||
Addr: "127.0.0.1:9109",
|
||||
},
|
||||
Reva: config.Reva{
|
||||
JWTSecret: "Pive-Fumkiu4",
|
||||
//JWTSecret: "Pive-Fumkiu4",
|
||||
SkipUserGroupsInToken: false,
|
||||
TransferExpires: 24 * 60 * 60,
|
||||
OIDC: config.OIDC{
|
||||
@@ -449,7 +449,7 @@ func DefaultConfig() *config.Config {
|
||||
GatewaySVC: defaultGatewayAddr,
|
||||
Insecure: false, // true?
|
||||
Timeout: 84300,
|
||||
JWTSecret: "Pive-Fumkiu4",
|
||||
//JWTSecret: "Pive-Fumkiu4",
|
||||
},
|
||||
Tracing: config.Tracing{
|
||||
Service: "storage",
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package parser
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/owncloud/ocis/extensions/storage-metadata/pkg/config"
|
||||
"github.com/owncloud/ocis/extensions/storage-metadata/pkg/config/defaults"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/config/envdecode"
|
||||
)
|
||||
|
||||
// ParseConfig loads accounts configuration from known paths.
|
||||
func ParseConfig(cfg *config.Config) error {
|
||||
_, err := ociscfg.BindSourcesToStructs(cfg.Service.Name, cfg)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
defaults.EnsureDefaults(cfg)
|
||||
|
||||
// load all env variables relevant to the config in the current context.
|
||||
if err := envdecode.Decode(cfg); err != nil {
|
||||
// no environment variable set for this config is an expected "error"
|
||||
if !errors.Is(err, envdecode.ErrNoTargetFieldsAreSet) {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
defaults.Sanitize(cfg)
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -12,6 +12,7 @@ import (
|
||||
"github.com/oklog/run"
|
||||
"github.com/owncloud/ocis/extensions/storage/pkg/server/debug"
|
||||
"github.com/owncloud/ocis/extensions/user/pkg/config"
|
||||
"github.com/owncloud/ocis/extensions/user/pkg/config/parser"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/ldap"
|
||||
"github.com/owncloud/ocis/ocis-pkg/log"
|
||||
@@ -26,6 +27,9 @@ func User(cfg *config.Config) *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "users",
|
||||
Usage: "start users service",
|
||||
Before: func(ctx *cli.Context) error {
|
||||
return parser.ParseConfig(cfg)
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
logCfg := cfg.Logging
|
||||
logger := log.NewLogger(
|
||||
@@ -116,8 +120,8 @@ func usersConfigFromStruct(c *cli.Context, cfg *config.Config) map[string]interf
|
||||
"tracing_service_name": c.Command.Name,
|
||||
},
|
||||
"shared": map[string]interface{}{
|
||||
"jwt_secret": cfg.JWTSecret,
|
||||
"gatewaysvc": cfg.GatewayEndpoint,
|
||||
"jwt_secret": cfg.TokenManager.JWTSecret,
|
||||
"gatewaysvc": cfg.Reva.Address,
|
||||
"skip_user_groups_in_token": cfg.SkipUserGroupsInToken,
|
||||
},
|
||||
"grpc": map[string]interface{}{
|
||||
|
||||
@@ -12,8 +12,9 @@ type Config struct {
|
||||
|
||||
GRPC GRPCConfig `yaml:"grpc,omitempty"`
|
||||
|
||||
JWTSecret string `yaml:"jwt_secret,omitempty"`
|
||||
GatewayEndpoint string `yaml:"gateway_endpoint,omitempty"`
|
||||
TokenManager *TokenManager `yaml:"token_manager,omitempty"`
|
||||
Reva *Reva `yaml:"reva,omitempty"`
|
||||
|
||||
SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token,omitempty"`
|
||||
UsersCacheExpiration int `yaml:"users_cache_expiration,omitempty"`
|
||||
Driver string `yaml:"driver,omitempty"`
|
||||
|
||||
@@ -31,9 +31,10 @@ func DefaultConfig() *config.Config {
|
||||
Name: "user",
|
||||
},
|
||||
UsersCacheExpiration: 5,
|
||||
GatewayEndpoint: "127.0.0.1:9142",
|
||||
JWTSecret: "Pive-Fumkiu4",
|
||||
Driver: "ldap",
|
||||
Reva: &config.Reva{
|
||||
Address: "127.0.0.1:9142",
|
||||
},
|
||||
Driver: "ldap",
|
||||
Drivers: config.Drivers{
|
||||
LDAP: config.LDAPDriver{
|
||||
URI: "ldaps://localhost:9126",
|
||||
@@ -106,6 +107,22 @@ func EnsureDefaults(cfg *config.Config) {
|
||||
} else if cfg.Tracing == nil {
|
||||
cfg.Tracing = &config.Tracing{}
|
||||
}
|
||||
|
||||
if cfg.Reva == nil && cfg.Commons != nil && cfg.Commons.Reva != nil {
|
||||
cfg.Reva = &config.Reva{
|
||||
Address: cfg.Commons.Reva.Address,
|
||||
}
|
||||
} else if cfg.Reva == nil {
|
||||
cfg.Reva = &config.Reva{}
|
||||
}
|
||||
|
||||
if cfg.TokenManager == nil && cfg.Commons != nil && cfg.Commons.TokenManager != nil {
|
||||
cfg.TokenManager = &config.TokenManager{
|
||||
JWTSecret: cfg.Commons.TokenManager.JWTSecret,
|
||||
}
|
||||
} else if cfg.TokenManager == nil {
|
||||
cfg.TokenManager = &config.TokenManager{}
|
||||
}
|
||||
}
|
||||
|
||||
func Sanitize(cfg *config.Config) {
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package parser
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/owncloud/ocis/extensions/user/pkg/config"
|
||||
"github.com/owncloud/ocis/extensions/user/pkg/config/defaults"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/config/envdecode"
|
||||
)
|
||||
|
||||
// ParseConfig loads accounts configuration from known paths.
|
||||
func ParseConfig(cfg *config.Config) error {
|
||||
_, err := ociscfg.BindSourcesToStructs(cfg.Service.Name, cfg)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
defaults.EnsureDefaults(cfg)
|
||||
|
||||
// load all env variables relevant to the config in the current context.
|
||||
if err := envdecode.Decode(cfg); err != nil {
|
||||
// no environment variable set for this config is an expected "error"
|
||||
if !errors.Is(err, envdecode.ErrNoTargetFieldsAreSet) {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
defaults.Sanitize(cfg)
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package config
|
||||
|
||||
// Reva defines all available REVA configuration.
|
||||
type Reva struct {
|
||||
Address string `yaml:"address" env:"REVA_GATEWAY"`
|
||||
}
|
||||
|
||||
// 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"`
|
||||
}
|
||||
@@ -31,47 +31,43 @@ import (
|
||||
user "github.com/owncloud/ocis/extensions/user/pkg/config/defaults"
|
||||
web "github.com/owncloud/ocis/extensions/web/pkg/config/defaults"
|
||||
webdav "github.com/owncloud/ocis/extensions/webdav/pkg/config/defaults"
|
||||
"github.com/owncloud/ocis/ocis-pkg/shared"
|
||||
)
|
||||
|
||||
func DefaultConfig() *Config {
|
||||
return &Config{
|
||||
TokenManager: &shared.TokenManager{
|
||||
JWTSecret: "Pive-Fumkiu4",
|
||||
},
|
||||
Runtime: Runtime{
|
||||
Port: "9250",
|
||||
Host: "localhost",
|
||||
},
|
||||
Audit: audit.DefaultConfig(),
|
||||
Accounts: accounts.DefaultConfig(),
|
||||
AppProvider: appprovider.DefaultConfig(),
|
||||
Audit: audit.DefaultConfig(),
|
||||
AuthBasic: authbasic.DefaultConfig(),
|
||||
AuthBearer: authbearer.DefaultConfig(),
|
||||
AuthMachine: authmachine.DefaultConfig(),
|
||||
Frontend: frontend.DefaultConfig(),
|
||||
Gateway: gateway.DefaultConfig(),
|
||||
GLAuth: glauth.DefaultConfig(),
|
||||
Graph: graph.DefaultConfig(),
|
||||
IDP: idp.DefaultConfig(),
|
||||
GraphExplorer: graphExplorer.DefaultConfig(),
|
||||
Group: group.DefaultConfig(),
|
||||
IDM: idm.DefaultConfig(),
|
||||
IDP: idp.DefaultConfig(),
|
||||
Nats: nats.DefaultConfig(),
|
||||
Notifications: notifications.DefaultConfig(),
|
||||
Proxy: proxy.DefaultConfig(),
|
||||
GraphExplorer: graphExplorer.DefaultConfig(),
|
||||
OCDav: ocdav.DefaultConfig(),
|
||||
OCS: ocs.DefaultConfig(),
|
||||
Proxy: proxy.DefaultConfig(),
|
||||
Settings: settings.DefaultConfig(),
|
||||
Web: web.DefaultConfig(),
|
||||
Sharing: sharing.DefaultConfig(),
|
||||
StorageMetadata: storagemetadata.DefaultConfig(),
|
||||
StoragePublicLink: storagepublic.DefaultConfig(),
|
||||
StorageShares: storageshares.DefaultConfig(),
|
||||
StorageUsers: storageusers.DefaultConfig(),
|
||||
Store: store.DefaultConfig(),
|
||||
Thumbnails: thumbnails.DefaultConfig(),
|
||||
User: user.DefaultConfig(),
|
||||
Web: web.DefaultConfig(),
|
||||
WebDAV: webdav.DefaultConfig(),
|
||||
Gateway: gateway.FullDefaultConfig(),
|
||||
AuthBasic: authbasic.FullDefaultConfig(),
|
||||
AuthBearer: authbearer.FullDefaultConfig(),
|
||||
AuthMachine: authmachine.FullDefaultConfig(),
|
||||
User: user.FullDefaultConfig(),
|
||||
Group: group.FullDefaultConfig(),
|
||||
Sharing: sharing.FullDefaultConfig(),
|
||||
StorageMetadata: storagemetadata.FullDefaultConfig(),
|
||||
StoragePublicLink: storagepublic.FullDefaultConfig(),
|
||||
StorageUsers: storageusers.FullDefaultConfig(),
|
||||
StorageShares: storageshares.FullDefaultConfig(),
|
||||
AppProvider: appprovider.FullDefaultConfig(),
|
||||
Frontend: frontend.FullDefaultConfig(),
|
||||
OCDav: ocdav.FullDefaultConfig(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
_ "github.com/owncloud/ocis/ocis-pkg/generators"
|
||||
)
|
||||
|
||||
var _ = Describe("Generators", func() {
|
||||
It("Returns an error ", func() {})
|
||||
PIt("Returns expected passwords", func() {})
|
||||
})
|
||||
//var _ = Describe("Generators", func() {
|
||||
// It("Returns an error ", func() {})
|
||||
// PIt("Returns expected passwords", func() {})
|
||||
//})
|
||||
|
||||
@@ -29,6 +29,11 @@ type TokenManager struct {
|
||||
JWTSecret string `yaml:"jwt_secret" env:"OCIS_JWT_SECRET" desc:"The secret to mint jwt tokens."`
|
||||
}
|
||||
|
||||
// Reva defines all available REVA configuration.
|
||||
type Reva struct {
|
||||
Address string `yaml:"address" env:"REVA_GATEWAY"`
|
||||
}
|
||||
|
||||
// Commons holds configuration that are common to all extensions. Each extension can then decide whether
|
||||
// to overwrite its values.
|
||||
type Commons struct {
|
||||
@@ -36,6 +41,7 @@ type Commons struct {
|
||||
Tracing *Tracing `yaml:"tracing"`
|
||||
OcisURL string `yaml:"ocis_url" env:"OCIS_URL"`
|
||||
TokenManager *TokenManager `yaml:"token_manager"`
|
||||
Reva *Reva `yaml:"reva"`
|
||||
MachineAuthAPIKey string `yaml:"machine_auth_api_key" env:"OCIS_MACHINE_AUTH_API_KEY"`
|
||||
TransferSecret string `yaml:"transfer_secret,omitempty" env:"REVA_TRANSFER_SECRET"`
|
||||
}
|
||||
|
||||
+40
-58
@@ -10,39 +10,22 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/config/defaults"
|
||||
"github.com/owncloud/ocis/ocis-pkg/generators"
|
||||
"github.com/owncloud/ocis/ocis-pkg/shared"
|
||||
"github.com/owncloud/ocis/ocis/pkg/register"
|
||||
cli "github.com/urfave/cli/v2"
|
||||
"gopkg.in/yaml.v3"
|
||||
|
||||
appprovider "github.com/owncloud/ocis/extensions/appprovider/pkg/config"
|
||||
authbasic "github.com/owncloud/ocis/extensions/auth-basic/pkg/config"
|
||||
authbearer "github.com/owncloud/ocis/extensions/auth-bearer/pkg/config"
|
||||
authmachine "github.com/owncloud/ocis/extensions/auth-machine/pkg/config"
|
||||
gateway "github.com/owncloud/ocis/extensions/gateway/pkg/config"
|
||||
group "github.com/owncloud/ocis/extensions/group/pkg/config"
|
||||
idm "github.com/owncloud/ocis/extensions/idm/pkg/config"
|
||||
ocdav "github.com/owncloud/ocis/extensions/ocdav/pkg/config"
|
||||
proxy "github.com/owncloud/ocis/extensions/proxy/pkg/config"
|
||||
sharing "github.com/owncloud/ocis/extensions/sharing/pkg/config"
|
||||
storagemetadata "github.com/owncloud/ocis/extensions/storage-metadata/pkg/config"
|
||||
storagepublic "github.com/owncloud/ocis/extensions/storage-publiclink/pkg/config"
|
||||
storageshares "github.com/owncloud/ocis/extensions/storage-shares/pkg/config"
|
||||
storageusers "github.com/owncloud/ocis/extensions/storage-users/pkg/config"
|
||||
user "github.com/owncloud/ocis/extensions/user/pkg/config"
|
||||
)
|
||||
|
||||
const configFilename string = "ocis.yaml"
|
||||
const configFilename string = "ocis.yaml" // TODO: use also a constant for reading this file
|
||||
const passwordLength int = 32
|
||||
|
||||
// InitCommand is the entrypoint for the init command
|
||||
func InitCommand(cfg *config.Config) *cli.Command {
|
||||
// TODO: remove homedir get
|
||||
homeDir, err := os.UserHomeDir()
|
||||
if err != nil {
|
||||
log.Fatalf("could not get homedir")
|
||||
}
|
||||
return &cli.Command{
|
||||
Name: "init",
|
||||
Usage: "initialise an ocis config",
|
||||
@@ -59,11 +42,9 @@ func InitCommand(cfg *config.Config) *cli.Command {
|
||||
Value: false,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "config-path",
|
||||
//Value: cfg.ConfigPath, // TODO: as soon as PR 3480 is merged, remove quotes
|
||||
Value: path.Join(homeDir, ".ocis/config"), // TODO: this is temporary for experimenting, line above is relevant
|
||||
Name: "config-path",
|
||||
Value: defaults.BaseConfigPath(),
|
||||
Usage: "config path for the ocis runtime",
|
||||
// Destination: &cfg.ConfigFile, // TODO: same as above
|
||||
},
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
@@ -93,7 +74,7 @@ func init() {
|
||||
func checkConfigPath(configPath string) error {
|
||||
targetPath := path.Join(configPath, configFilename)
|
||||
if _, err := os.Stat(targetPath); err == nil {
|
||||
return fmt.Errorf("Config in %s already exists", targetPath)
|
||||
return fmt.Errorf("config in %s already exists", targetPath)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -122,19 +103,19 @@ func createConfig(insecure, forceOverwrite bool, configPath string) error {
|
||||
//OCS: &ocs.Config{},
|
||||
//Settings: &settings.Config{},
|
||||
// TODO: fix storage
|
||||
AuthBasic: &authbasic.Config{},
|
||||
AuthBearer: &authbearer.Config{},
|
||||
AppProvider: &appprovider.Config{},
|
||||
AuthMachine: &authmachine.Config{},
|
||||
Gateway: &gateway.Config{},
|
||||
Group: &group.Config{},
|
||||
Sharing: &sharing.Config{},
|
||||
StorageMetadata: &storagemetadata.Config{},
|
||||
StorageUsers: &storageusers.Config{},
|
||||
StorageShares: &storageshares.Config{},
|
||||
StoragePublicLink: &storagepublic.Config{},
|
||||
User: &user.Config{},
|
||||
OCDav: &ocdav.Config{},
|
||||
//AuthBasic: &authbasic.Config{},
|
||||
//AuthBearer: &authbearer.Config{},
|
||||
//AppProvider: &appprovider.Config{},
|
||||
//AuthMachine: &authmachine.Config{},
|
||||
//Gateway: &gateway.Config{},
|
||||
//Group: &group.Config{},
|
||||
//Sharing: &sharing.Config{},
|
||||
//StorageMetadata: &storagemetadata.Config{},
|
||||
//StorageUsers: &storageusers.Config{},
|
||||
//StorageShares: &storageshares.Config{},
|
||||
//StoragePublicLink: &storagepublic.Config{},
|
||||
//User: &user.Config{},
|
||||
//OCDav: &ocdav.Config{},
|
||||
//Thumbnails: &thumbnails.Config{},
|
||||
//Web: &web.Config{},
|
||||
//WebDAV: &webdav.Config{},
|
||||
@@ -147,31 +128,31 @@ func createConfig(insecure, forceOverwrite bool, configPath string) error {
|
||||
|
||||
idmServicePassword, err := generators.GenerateRandomPassword(passwordLength)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Could not generate random password for idm: %s", err)
|
||||
return fmt.Errorf("could not generate random password for idm: %s", err)
|
||||
}
|
||||
idpServicePassword, err := generators.GenerateRandomPassword(passwordLength)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Could not generate random password for idp: %s", err)
|
||||
return fmt.Errorf("could not generate random password for idp: %s", err)
|
||||
}
|
||||
ocisAdminServicePassword, err := generators.GenerateRandomPassword(passwordLength)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Could not generate random password for ocis admin: %s", err)
|
||||
return fmt.Errorf("could not generate random password for ocis admin: %s", err)
|
||||
}
|
||||
revaServicePassword, err := generators.GenerateRandomPassword(passwordLength)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Could not generate random password for reva: %s", err)
|
||||
return fmt.Errorf("could not generate random password for reva: %s", err)
|
||||
}
|
||||
tokenManagerJwtSecret, err := generators.GenerateRandomPassword(passwordLength)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Could not generate random password for tokenmanager: %s", err)
|
||||
return fmt.Errorf("could not generate random password for tokenmanager: %s", err)
|
||||
}
|
||||
machineAuthApiKey, err := generators.GenerateRandomPassword(passwordLength)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Could not generate random password for machineauthsecret: %s", err)
|
||||
return fmt.Errorf("could not generate random password for machineauthsecret: %s", err)
|
||||
}
|
||||
revaTransferTokenSecret, err := generators.GenerateRandomPassword(passwordLength)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Could not generate random password for machineauthsecret: %s", err)
|
||||
return fmt.Errorf("could not generate random password for machineauthsecret: %s", err)
|
||||
}
|
||||
|
||||
// TODO: IDP config is missing (LDAP + GROUP provider)
|
||||
@@ -199,26 +180,27 @@ func createConfig(insecure, forceOverwrite bool, configPath string) error {
|
||||
//cfg.Settings.TokenManager.JWTSecret = tokenManagerJwtSecret
|
||||
|
||||
//TODO: move all jwt secrets to shared.common
|
||||
cfg.AppProvider.JWTSecret = tokenManagerJwtSecret
|
||||
cfg.AuthBasic.JWTSecret = tokenManagerJwtSecret
|
||||
cfg.AuthBearer.JWTSecret = tokenManagerJwtSecret
|
||||
cfg.AuthMachine.JWTSecret = tokenManagerJwtSecret
|
||||
cfg.Gateway.JWTSecret = tokenManagerJwtSecret
|
||||
//cfg.AppProvider.JWTSecret = tokenManagerJwtSecret
|
||||
//cfg.AuthBasic.JWTSecret = tokenManagerJwtSecret
|
||||
//cfg.AuthBearer.JWTSecret = tokenManagerJwtSecret
|
||||
//cfg.AuthMachine.JWTSecret = tokenManagerJwtSecret
|
||||
//cfg.Gateway.JWTSecret = tokenManagerJwtSecret
|
||||
//cfg.Group.JWTSecret = tokenManagerJwtSecret
|
||||
//cfg.Sharing.JWTSecret = tokenManagerJwtSecret
|
||||
//cfg.StorageMetadata.JWTSecret = tokenManagerJwtSecret
|
||||
//cfg.StoragePublicLink.JWTSecret = tokenManagerJwtSecret
|
||||
//cfg.StorageShares.JWTSecret = tokenManagerJwtSecret
|
||||
//cfg.StorageUsers.JWTSecret = tokenManagerJwtSecret
|
||||
//cfg.User.JWTSecret = tokenManagerJwtSecret
|
||||
//cfg.OCDav.JWTSecret = tokenManagerJwtSecret
|
||||
|
||||
//TODO: following line is defunc, figure out why
|
||||
//cfg.Gateway.MachineAuthAPIKey = machineAuthApiKey
|
||||
cfg.Group.JWTSecret = tokenManagerJwtSecret
|
||||
cfg.Sharing.JWTSecret = tokenManagerJwtSecret
|
||||
cfg.StorageMetadata.JWTSecret = tokenManagerJwtSecret
|
||||
cfg.StoragePublicLink.JWTSecret = tokenManagerJwtSecret
|
||||
cfg.StorageShares.JWTSecret = tokenManagerJwtSecret
|
||||
cfg.StorageUsers.JWTSecret = tokenManagerJwtSecret
|
||||
cfg.User.JWTSecret = tokenManagerJwtSecret
|
||||
cfg.OCDav.JWTSecret = tokenManagerJwtSecret
|
||||
|
||||
//cfg.Thumbnails.Thumbnail.TransferSecret = revaTransferTokenSecret
|
||||
yamlOutput, err := yaml.Marshal(cfg)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Could not marshall config into yaml: %s", err)
|
||||
return fmt.Errorf("could not marshall config into yaml: %s", err)
|
||||
}
|
||||
targetPath := path.Join(configPath, configFilename)
|
||||
err = ioutil.WriteFile(targetPath, yamlOutput, 0600)
|
||||
|
||||
Reference in New Issue
Block a user