mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-04 03:09:33 -06:00
split **/pkg/config/config.go up to multiple files
This commit is contained in:
@@ -1,49 +1,31 @@
|
||||
// Package config should be moved to internal
|
||||
package config
|
||||
|
||||
import (
|
||||
"context"
|
||||
"path"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/config/defaults"
|
||||
)
|
||||
|
||||
//TODO: use debug config
|
||||
// Debug defines the available debug configuration.
|
||||
type Debug struct {
|
||||
Addr string `ocisConfig:"addr" env:"ACCOUNTS_DEBUG_ADDR"`
|
||||
Token string `ocisConfig:"token" env:"ACCOUNTS_DEBUG_TOKEN"`
|
||||
Pprof bool `ocisConfig:"pprof" env:"ACCOUNTS_DEBUG_PPROF"`
|
||||
Zpages bool `ocisConfig:"zpages" env:"ACCOUNTS_DEBUG_ZPAGES"`
|
||||
}
|
||||
// Config combines all available configuration parts.
|
||||
type Config struct {
|
||||
Service Service
|
||||
|
||||
// CORS defines the available cors configuration.
|
||||
type CORS struct {
|
||||
AllowedOrigins []string `ocisConfig:"allowed_origins"`
|
||||
AllowedMethods []string `ocisConfig:"allowed_methods"`
|
||||
AllowedHeaders []string `ocisConfig:"allowed_headers"`
|
||||
AllowCredentials bool `ocisConfig:"allowed_credentials"`
|
||||
}
|
||||
Tracing Tracing `ocisConfig:"tracing"`
|
||||
Log Log `ocisConfig:"log"`
|
||||
Debug Debug `ocisConfig:"debug"`
|
||||
|
||||
// HTTP defines the available http configuration.
|
||||
type HTTP struct {
|
||||
Addr string `ocisConfig:"addr" env:"ACCOUNTS_HTTP_ADDR"`
|
||||
Namespace string
|
||||
Root string `ocisConfig:"root" env:"ACCOUNTS_HTTP_ROOT"`
|
||||
CacheTTL int `ocisConfig:"cache_ttl" env:"ACCOUNTS_CACHE_TTL"`
|
||||
CORS CORS `ocisConfig:"cors"`
|
||||
}
|
||||
HTTP HTTP `ocisConfig:"http"`
|
||||
GRPC GRPC `ocisConfig:"grpc"`
|
||||
|
||||
// GRPC defines the available grpc configuration.
|
||||
type GRPC struct {
|
||||
Addr string `ocisConfig:"addr" env:"ACCOUNTS_GRPC_ADDR"`
|
||||
Namespace string
|
||||
}
|
||||
TokenManager TokenManager `ocisConfig:"token_manager"`
|
||||
|
||||
// Service defines the available service configuration.
|
||||
type Service struct {
|
||||
Name string
|
||||
Version string
|
||||
Asset Asset `ocisConfig:"asset"`
|
||||
Repo Repo `ocisConfig:"repo"`
|
||||
Index Index `ocisConfig:"index"`
|
||||
ServiceUser ServiceUser `ocisConfig:"service_user"`
|
||||
HashDifficulty int `ocisConfig:"hash_difficulty" env:"ACCOUNTS_HASH_DIFFICULTY"`
|
||||
DemoUsersAndGroups bool `ocisConfig:"demo_users_and_groups" env:"ACCOUNTS_DEMO_USERS_AND_GROUPS"`
|
||||
|
||||
Context context.Context
|
||||
Supervised bool
|
||||
}
|
||||
|
||||
// Asset defines the available asset configuration.
|
||||
@@ -99,107 +81,3 @@ type UIDBound struct {
|
||||
Lower int64 `ocisConfig:"lower" env:"ACCOUNTS_UID_INDEX_LOWER_BOUND"`
|
||||
Upper int64 `ocisConfig:"upper" env:"ACCOUNTS_UID_INDEX_UPPER_BOUND"`
|
||||
}
|
||||
|
||||
// Tracing defines the available tracing configuration.
|
||||
type Tracing struct {
|
||||
Enabled bool `ocisConfig:"enabled" env:"OCIS_TRACING_ENABLED;ACCOUNTS_TRACING_ENABLED"`
|
||||
Type string `ocisConfig:"type" env:"OCIS_TRACING_TYPE;ACCOUNTS_TRACING_TYPE"`
|
||||
Endpoint string `ocisConfig:"endpoint" env:"OCIS_TRACING_ENDPOINT;ACCOUNTS_TRACING_ENDPOINT"`
|
||||
Collector string `ocisConfig:"collector" env:"OCIS_TRACING_COLLECTOR;ACCOUNTS_TRACING_COLLECTOR"`
|
||||
Service string `ocisConfig:"service" env:"ACCOUNTS_TRACING_SERVICE"` //TODO: should this be an ID? or the same as Service.Name?
|
||||
}
|
||||
|
||||
// Log defines the available log configuration.
|
||||
type Log struct {
|
||||
Level string `mapstructure:"level" env:"OCIS_LOG_LEVEL;ACCOUNTS_LOG_LEVEL"`
|
||||
Pretty bool `mapstructure:"pretty" env:"OCIS_LOG_PRETTY;ACCOUNTS_LOG_PRETTY"`
|
||||
Color bool `mapstructure:"color" env:"OCIS_LOG_COLOR;ACCOUNTS_LOG_COLOR"`
|
||||
File string `mapstructure:"file" env:"OCIS_LOG_FILE;ACCOUNTS_LOG_FILE"`
|
||||
}
|
||||
|
||||
// Config merges all Account config parameters.
|
||||
type Config struct {
|
||||
//*shared.Commons
|
||||
|
||||
Service Service `ocisConfig:"service"`
|
||||
|
||||
Tracing Tracing `ocisConfig:"tracing"`
|
||||
Log Log `ocisConfig:"log"`
|
||||
Debug Debug `ocisConfig:"debug"`
|
||||
|
||||
HTTP HTTP `ocisConfig:"http"`
|
||||
GRPC GRPC `ocisConfig:"grpc"`
|
||||
|
||||
TokenManager TokenManager `ocisConfig:"token_manager"`
|
||||
|
||||
Asset Asset `ocisConfig:"asset"`
|
||||
Repo Repo `ocisConfig:"repo"`
|
||||
Index Index `ocisConfig:"index"`
|
||||
ServiceUser ServiceUser `ocisConfig:"service_user"`
|
||||
HashDifficulty int `ocisConfig:"hash_difficulty" env:"ACCOUNTS_HASH_DIFFICULTY"`
|
||||
DemoUsersAndGroups bool `ocisConfig:"demo_users_and_groups" env:"ACCOUNTS_DEMO_USERS_AND_GROUPS"`
|
||||
|
||||
Context context.Context
|
||||
Supervised bool
|
||||
}
|
||||
|
||||
func DefaultConfig() *Config {
|
||||
return &Config{
|
||||
|
||||
HTTP: HTTP{
|
||||
Addr: "127.0.0.1:9181",
|
||||
Namespace: "com.owncloud.web",
|
||||
Root: "/",
|
||||
CacheTTL: 604800, // 7 days
|
||||
CORS: CORS{
|
||||
AllowedOrigins: []string{"*"},
|
||||
AllowedMethods: []string{"GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"},
|
||||
AllowedHeaders: []string{"Authorization", "Origin", "Content-Type", "Accept", "X-Requested-With"},
|
||||
AllowCredentials: true,
|
||||
},
|
||||
},
|
||||
GRPC: GRPC{
|
||||
Addr: "127.0.0.1:9180",
|
||||
Namespace: "com.owncloud.api",
|
||||
},
|
||||
Service: Service{
|
||||
Name: "accounts",
|
||||
},
|
||||
Asset: Asset{},
|
||||
TokenManager: TokenManager{
|
||||
JWTSecret: "Pive-Fumkiu4",
|
||||
},
|
||||
HashDifficulty: 11,
|
||||
DemoUsersAndGroups: true,
|
||||
Repo: Repo{
|
||||
Backend: "CS3",
|
||||
Disk: Disk{
|
||||
Path: path.Join(defaults.BaseDataPath(), "accounts"),
|
||||
},
|
||||
CS3: CS3{
|
||||
ProviderAddr: "localhost:9215",
|
||||
JWTSecret: "Pive-Fumkiu4",
|
||||
},
|
||||
},
|
||||
Index: Index{
|
||||
UID: UIDBound{
|
||||
Lower: 0,
|
||||
Upper: 1000,
|
||||
},
|
||||
GID: GIDBound{
|
||||
Lower: 0,
|
||||
Upper: 1000,
|
||||
},
|
||||
},
|
||||
ServiceUser: ServiceUser{
|
||||
UUID: "95cb8724-03b2-11eb-a0a6-c33ef8ef53ad",
|
||||
Username: "",
|
||||
UID: 0,
|
||||
GID: 0,
|
||||
},
|
||||
Tracing: Tracing{
|
||||
Type: "jaeger",
|
||||
Service: "accounts",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
10
accounts/pkg/config/debug.go
Normal file
10
accounts/pkg/config/debug.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package config
|
||||
|
||||
//TODO: use debug config
|
||||
// Debug defines the available debug configuration.
|
||||
type Debug struct {
|
||||
Addr string `ocisConfig:"addr" env:"ACCOUNTS_DEBUG_ADDR"`
|
||||
Token string `ocisConfig:"token" env:"ACCOUNTS_DEBUG_TOKEN"`
|
||||
Pprof bool `ocisConfig:"pprof" env:"ACCOUNTS_DEBUG_PPROF"`
|
||||
Zpages bool `ocisConfig:"zpages" env:"ACCOUNTS_DEBUG_ZPAGES"`
|
||||
}
|
||||
68
accounts/pkg/config/defaultconfig.go
Normal file
68
accounts/pkg/config/defaultconfig.go
Normal file
@@ -0,0 +1,68 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"path"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/config/defaults"
|
||||
)
|
||||
|
||||
func DefaultConfig() *Config {
|
||||
return &Config{
|
||||
|
||||
HTTP: HTTP{
|
||||
Addr: "127.0.0.1:9181",
|
||||
Namespace: "com.owncloud.web",
|
||||
Root: "/",
|
||||
CacheTTL: 604800, // 7 days
|
||||
CORS: CORS{
|
||||
AllowedOrigins: []string{"*"},
|
||||
AllowedMethods: []string{"GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"},
|
||||
AllowedHeaders: []string{"Authorization", "Origin", "Content-Type", "Accept", "X-Requested-With"},
|
||||
AllowCredentials: true,
|
||||
},
|
||||
},
|
||||
GRPC: GRPC{
|
||||
Addr: "127.0.0.1:9180",
|
||||
Namespace: "com.owncloud.api",
|
||||
},
|
||||
Service: Service{
|
||||
Name: "accounts",
|
||||
},
|
||||
Asset: Asset{},
|
||||
TokenManager: TokenManager{
|
||||
JWTSecret: "Pive-Fumkiu4",
|
||||
},
|
||||
HashDifficulty: 11,
|
||||
DemoUsersAndGroups: true,
|
||||
Repo: Repo{
|
||||
Backend: "CS3",
|
||||
Disk: Disk{
|
||||
Path: path.Join(defaults.BaseDataPath(), "accounts"),
|
||||
},
|
||||
CS3: CS3{
|
||||
ProviderAddr: "localhost:9215",
|
||||
JWTSecret: "Pive-Fumkiu4",
|
||||
},
|
||||
},
|
||||
Index: Index{
|
||||
UID: UIDBound{
|
||||
Lower: 0,
|
||||
Upper: 1000,
|
||||
},
|
||||
GID: GIDBound{
|
||||
Lower: 0,
|
||||
Upper: 1000,
|
||||
},
|
||||
},
|
||||
ServiceUser: ServiceUser{
|
||||
UUID: "95cb8724-03b2-11eb-a0a6-c33ef8ef53ad",
|
||||
Username: "",
|
||||
UID: 0,
|
||||
GID: 0,
|
||||
},
|
||||
Tracing: Tracing{
|
||||
Type: "jaeger",
|
||||
Service: "accounts",
|
||||
},
|
||||
}
|
||||
}
|
||||
7
accounts/pkg/config/grpc.go
Normal file
7
accounts/pkg/config/grpc.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package config
|
||||
|
||||
// GRPC defines the available grpc configuration.
|
||||
type GRPC struct {
|
||||
Addr string `ocisConfig:"addr" env:"ACCOUNTS_GRPC_ADDR"`
|
||||
Namespace string
|
||||
}
|
||||
18
accounts/pkg/config/http.go
Normal file
18
accounts/pkg/config/http.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package config
|
||||
|
||||
// HTTP defines the available http configuration.
|
||||
type HTTP struct {
|
||||
Addr string `ocisConfig:"addr" env:"ACCOUNTS_HTTP_ADDR"`
|
||||
Namespace string
|
||||
Root string `ocisConfig:"root" env:"ACCOUNTS_HTTP_ROOT"`
|
||||
CacheTTL int `ocisConfig:"cache_ttl" env:"ACCOUNTS_CACHE_TTL"`
|
||||
CORS CORS `ocisConfig:"cors"`
|
||||
}
|
||||
|
||||
// CORS defines the available cors configuration.
|
||||
type CORS struct {
|
||||
AllowedOrigins []string `ocisConfig:"allowed_origins"`
|
||||
AllowedMethods []string `ocisConfig:"allowed_methods"`
|
||||
AllowedHeaders []string `ocisConfig:"allowed_headers"`
|
||||
AllowCredentials bool `ocisConfig:"allowed_credentials"`
|
||||
}
|
||||
9
accounts/pkg/config/log.go
Normal file
9
accounts/pkg/config/log.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package config
|
||||
|
||||
// Log defines the available log configuration.
|
||||
type Log struct {
|
||||
Level string `mapstructure:"level" env:"OCIS_LOG_LEVEL;ACCOUNTS_LOG_LEVEL"`
|
||||
Pretty bool `mapstructure:"pretty" env:"OCIS_LOG_PRETTY;ACCOUNTS_LOG_PRETTY"`
|
||||
Color bool `mapstructure:"color" env:"OCIS_LOG_COLOR;ACCOUNTS_LOG_COLOR"`
|
||||
File string `mapstructure:"file" env:"OCIS_LOG_FILE;ACCOUNTS_LOG_FILE"`
|
||||
}
|
||||
7
accounts/pkg/config/service.go
Normal file
7
accounts/pkg/config/service.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package config
|
||||
|
||||
// Service defines the available service configuration.
|
||||
type Service struct {
|
||||
Name string
|
||||
Version string
|
||||
}
|
||||
10
accounts/pkg/config/tracing.go
Normal file
10
accounts/pkg/config/tracing.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package config
|
||||
|
||||
// Tracing defines the available tracing configuration.
|
||||
type Tracing struct {
|
||||
Enabled bool `ocisConfig:"enabled" env:"OCIS_TRACING_ENABLED;ACCOUNTS_TRACING_ENABLED"`
|
||||
Type string `ocisConfig:"type" env:"OCIS_TRACING_TYPE;ACCOUNTS_TRACING_TYPE"`
|
||||
Endpoint string `ocisConfig:"endpoint" env:"OCIS_TRACING_ENDPOINT;ACCOUNTS_TRACING_ENDPOINT"`
|
||||
Collector string `ocisConfig:"collector" env:"OCIS_TRACING_COLLECTOR;ACCOUNTS_TRACING_COLLECTOR"`
|
||||
Service string `ocisConfig:"service" env:"ACCOUNTS_TRACING_SERVICE"` //TODO: should this be an ID? or the same as Service.Name?
|
||||
}
|
||||
@@ -2,58 +2,26 @@ package config
|
||||
|
||||
import (
|
||||
"context"
|
||||
"path"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/shared"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/config/defaults"
|
||||
)
|
||||
|
||||
// Debug defines the available debug configuration.
|
||||
type Debug struct {
|
||||
Addr string `ocisConfig:"addr" env:"GLAUTH_DEBUG_ADDR"`
|
||||
Token string `ocisConfig:"token" env:"GLAUTH_DEBUG_TOKEN"`
|
||||
Pprof bool `ocisConfig:"pprof" env:"GLAUTH_DEBUG_PPROF"`
|
||||
Zpages bool `ocisConfig:"zpages" env:"GLAUTH_DEBUG_ZPAGES"`
|
||||
}
|
||||
// Config combines all available configuration parts.
|
||||
type Config struct {
|
||||
Service Service
|
||||
|
||||
// Service defines the available service configuration.
|
||||
type Service struct {
|
||||
Name string
|
||||
Version string
|
||||
}
|
||||
Tracing Tracing `ocisConfig:"tracing"`
|
||||
Log Log `ocisConfig:"log"`
|
||||
Debug Debug `ocisConfig:"debug"`
|
||||
|
||||
// Tracing defines the available tracing configuration.
|
||||
type Tracing struct {
|
||||
Enabled bool `ocisConfig:"enabled" env:"OCIS_TRACING_ENABLED;GLAUTH_TRACING_ENABLED"`
|
||||
Type string `ocisConfig:"type" env:"OCIS_TRACING_TYPE;GLAUTH_TRACING_TYPE"`
|
||||
Endpoint string `ocisConfig:"endpoint" env:"OCIS_TRACING_ENDPOINT;GLAUTH_TRACING_ENDPOINT"`
|
||||
Collector string `ocisConfig:"collector" env:"OCIS_TRACING_COLLECTOR;GLAUTH_TRACING_COLLECTOR"`
|
||||
Service string `ocisConfig:"service" env:"GLAUTH_TRACING_SERVICE"` // TODO:
|
||||
}
|
||||
Ldap Ldap `ocisConfig:"ldap"`
|
||||
Ldaps Ldaps `ocisConfig:"ldaps"`
|
||||
|
||||
// Log defines the available log configuration.
|
||||
type Log struct {
|
||||
Level string `mapstructure:"level" env:"OCIS_LOG_LEVEL;GLAUTH_LOG_LEVEL"`
|
||||
Pretty bool `mapstructure:"pretty" env:"OCIS_LOG_PRETTY;GLAUTH_LOG_PRETTY"`
|
||||
Color bool `mapstructure:"color" env:"OCIS_LOG_COLOR;GLAUTH_LOG_COLOR"`
|
||||
File string `mapstructure:"file" env:"OCIS_LOG_FILE;GLAUTH_LOG_FILE"`
|
||||
}
|
||||
Backend Backend `ocisConfig:"backend"`
|
||||
Fallback FallbackBackend `ocisConfig:"fallback"`
|
||||
|
||||
// Ldap defined the available LDAP configuration.
|
||||
type Ldap struct {
|
||||
Enabled bool `ocisConfig:"enabled" env:"GLAUTH_LDAP_ENABLED"`
|
||||
Addr string `ocisConfig:"addr" env:"GLAUTH_LDAP_ADDR"`
|
||||
Namespace string
|
||||
}
|
||||
RoleBundleUUID string `ocisConfig:"role_bundle_uuid" env:"GLAUTH_ROLE_BUNDLE_ID"`
|
||||
|
||||
// Ldaps defined the available LDAPS configuration.
|
||||
type Ldaps struct {
|
||||
Enabled bool `ocisConfig:"enabled" env:"GLAUTH_LDAPS_ENABLED"`
|
||||
Addr string `ocisConfig:"addr" env:"GLAUTH_LDAPS_ADDR"`
|
||||
Namespace string
|
||||
Cert string `ocisConfig:"cert" env:"GLAUTH_LDAPS_CERT"`
|
||||
Key string `ocisConfig:"key" env:"GLAUTH_LDAPS_KEY"`
|
||||
Context context.Context
|
||||
Supervised bool
|
||||
}
|
||||
|
||||
// Backend defined the available backend configuration.
|
||||
@@ -79,73 +47,3 @@ type FallbackBackend struct {
|
||||
SSHKeyAttr string `ocisConfig:"ssh_key_attr" env:"GLAUTH_FALLBACK_SSH_KEY_ATTR"`
|
||||
UseGraphAPI bool `ocisConfig:"use_graph_api" env:"GLAUTH_FALLBACK_USE_GRAPHAPI"`
|
||||
}
|
||||
|
||||
// Config combines all available configuration parts.
|
||||
type Config struct {
|
||||
*shared.Commons
|
||||
|
||||
Service Service `ocisConfig:"service"`
|
||||
|
||||
Tracing Tracing `ocisConfig:"tracing"`
|
||||
Log Log `ocisConfig:"log"`
|
||||
Debug Debug `ocisConfig:"debug"`
|
||||
|
||||
Ldap Ldap `ocisConfig:"ldap"`
|
||||
Ldaps Ldaps `ocisConfig:"ldaps"`
|
||||
|
||||
Backend Backend `ocisConfig:"backend"`
|
||||
Fallback FallbackBackend `ocisConfig:"fallback"`
|
||||
|
||||
RoleBundleUUID string `ocisConfig:"role_bundle_uuid" env:"GLAUTH_ROLE_BUNDLE_ID"`
|
||||
|
||||
Context context.Context
|
||||
Supervised bool
|
||||
}
|
||||
|
||||
func DefaultConfig() *Config {
|
||||
return &Config{
|
||||
Debug: Debug{
|
||||
Addr: "127.0.0.1:9129",
|
||||
},
|
||||
Tracing: Tracing{
|
||||
Type: "jaeger",
|
||||
Service: "glauth",
|
||||
},
|
||||
Service: Service{
|
||||
Name: "glauth",
|
||||
},
|
||||
Ldap: Ldap{
|
||||
Enabled: true,
|
||||
Addr: "127.0.0.1:9125",
|
||||
Namespace: "com.owncloud.ldap",
|
||||
},
|
||||
Ldaps: Ldaps{
|
||||
Enabled: true,
|
||||
Addr: "127.0.0.1:9126",
|
||||
Namespace: "com.owncloud.ldaps",
|
||||
Cert: path.Join(defaults.BaseDataPath(), "ldap", "ldap.crt"),
|
||||
Key: path.Join(defaults.BaseDataPath(), "ldap", "ldap.key"),
|
||||
},
|
||||
Backend: Backend{
|
||||
Datastore: "accounts",
|
||||
BaseDN: "dc=ocis,dc=test",
|
||||
Insecure: false,
|
||||
NameFormat: "cn",
|
||||
GroupFormat: "ou",
|
||||
Servers: nil,
|
||||
SSHKeyAttr: "sshPublicKey",
|
||||
UseGraphAPI: true,
|
||||
},
|
||||
Fallback: FallbackBackend{
|
||||
Datastore: "",
|
||||
BaseDN: "dc=ocis,dc=test",
|
||||
Insecure: false,
|
||||
NameFormat: "cn",
|
||||
GroupFormat: "ou",
|
||||
Servers: nil,
|
||||
SSHKeyAttr: "sshPublicKey",
|
||||
UseGraphAPI: true,
|
||||
},
|
||||
RoleBundleUUID: "71881883-1768-46bd-a24d-a356a2afdf7f", // BundleUUIDRoleAdmin
|
||||
}
|
||||
}
|
||||
|
||||
9
glauth/pkg/config/debug.go
Normal file
9
glauth/pkg/config/debug.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package config
|
||||
|
||||
// Debug defines the available debug configuration.
|
||||
type Debug struct {
|
||||
Addr string `ocisConfig:"addr" env:"GLAUTH_DEBUG_ADDR"`
|
||||
Token string `ocisConfig:"token" env:"GLAUTH_DEBUG_TOKEN"`
|
||||
Pprof bool `ocisConfig:"pprof" env:"GLAUTH_DEBUG_PPROF"`
|
||||
Zpages bool `ocisConfig:"zpages" env:"GLAUTH_DEBUG_ZPAGES"`
|
||||
}
|
||||
55
glauth/pkg/config/defaultconfig.go
Normal file
55
glauth/pkg/config/defaultconfig.go
Normal file
@@ -0,0 +1,55 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"path"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/config/defaults"
|
||||
)
|
||||
|
||||
func DefaultConfig() *Config {
|
||||
return &Config{
|
||||
Debug: Debug{
|
||||
Addr: "127.0.0.1:9129",
|
||||
},
|
||||
Tracing: Tracing{
|
||||
Type: "jaeger",
|
||||
Service: "glauth",
|
||||
},
|
||||
Service: Service{
|
||||
Name: "glauth",
|
||||
},
|
||||
Ldap: Ldap{
|
||||
Enabled: true,
|
||||
Addr: "127.0.0.1:9125",
|
||||
Namespace: "com.owncloud.ldap",
|
||||
},
|
||||
Ldaps: Ldaps{
|
||||
Enabled: true,
|
||||
Addr: "127.0.0.1:9126",
|
||||
Namespace: "com.owncloud.ldaps",
|
||||
Cert: path.Join(defaults.BaseDataPath(), "ldap", "ldap.crt"),
|
||||
Key: path.Join(defaults.BaseDataPath(), "ldap", "ldap.key"),
|
||||
},
|
||||
Backend: Backend{
|
||||
Datastore: "accounts",
|
||||
BaseDN: "dc=ocis,dc=test",
|
||||
Insecure: false,
|
||||
NameFormat: "cn",
|
||||
GroupFormat: "ou",
|
||||
Servers: nil,
|
||||
SSHKeyAttr: "sshPublicKey",
|
||||
UseGraphAPI: true,
|
||||
},
|
||||
Fallback: FallbackBackend{
|
||||
Datastore: "",
|
||||
BaseDN: "dc=ocis,dc=test",
|
||||
Insecure: false,
|
||||
NameFormat: "cn",
|
||||
GroupFormat: "ou",
|
||||
Servers: nil,
|
||||
SSHKeyAttr: "sshPublicKey",
|
||||
UseGraphAPI: true,
|
||||
},
|
||||
RoleBundleUUID: "71881883-1768-46bd-a24d-a356a2afdf7f", // BundleUUIDRoleAdmin
|
||||
}
|
||||
}
|
||||
8
glauth/pkg/config/ldap.go
Normal file
8
glauth/pkg/config/ldap.go
Normal file
@@ -0,0 +1,8 @@
|
||||
package config
|
||||
|
||||
// Ldap defines the available LDAP configuration.
|
||||
type Ldap struct {
|
||||
Enabled bool `ocisConfig:"enabled" env:"GLAUTH_LDAP_ENABLED"`
|
||||
Addr string `ocisConfig:"addr" env:"GLAUTH_LDAP_ADDR"`
|
||||
Namespace string
|
||||
}
|
||||
10
glauth/pkg/config/ldaps.go
Normal file
10
glauth/pkg/config/ldaps.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package config
|
||||
|
||||
// Ldaps defined the available LDAPS configuration.
|
||||
type Ldaps struct {
|
||||
Enabled bool `ocisConfig:"enabled" env:"GLAUTH_LDAPS_ENABLED"`
|
||||
Addr string `ocisConfig:"addr" env:"GLAUTH_LDAPS_ADDR"`
|
||||
Namespace string
|
||||
Cert string `ocisConfig:"cert" env:"GLAUTH_LDAPS_CERT"`
|
||||
Key string `ocisConfig:"key" env:"GLAUTH_LDAPS_KEY"`
|
||||
}
|
||||
9
glauth/pkg/config/log.go
Normal file
9
glauth/pkg/config/log.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package config
|
||||
|
||||
// Log defines the available log configuration.
|
||||
type Log struct {
|
||||
Level string `mapstructure:"level" env:"OCIS_LOG_LEVEL;GLAUTH_LOG_LEVEL"`
|
||||
Pretty bool `mapstructure:"pretty" env:"OCIS_LOG_PRETTY;GLAUTH_LOG_PRETTY"`
|
||||
Color bool `mapstructure:"color" env:"OCIS_LOG_COLOR;GLAUTH_LOG_COLOR"`
|
||||
File string `mapstructure:"file" env:"OCIS_LOG_FILE;GLAUTH_LOG_FILE"`
|
||||
}
|
||||
7
glauth/pkg/config/service.go
Normal file
7
glauth/pkg/config/service.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package config
|
||||
|
||||
// Service defines the available service configuration.
|
||||
type Service struct {
|
||||
Name string
|
||||
Version string
|
||||
}
|
||||
10
glauth/pkg/config/tracing.go
Normal file
10
glauth/pkg/config/tracing.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package config
|
||||
|
||||
// Tracing defines the available tracing configuration.
|
||||
type Tracing struct {
|
||||
Enabled bool `ocisConfig:"enabled" env:"OCIS_TRACING_ENABLED;GLAUTH_TRACING_ENABLED"`
|
||||
Type string `ocisConfig:"type" env:"OCIS_TRACING_TYPE;GLAUTH_TRACING_TYPE"`
|
||||
Endpoint string `ocisConfig:"endpoint" env:"OCIS_TRACING_ENDPOINT;GLAUTH_TRACING_ENDPOINT"`
|
||||
Collector string `ocisConfig:"collector" env:"OCIS_TRACING_COLLECTOR;GLAUTH_TRACING_COLLECTOR"`
|
||||
Service string `ocisConfig:"service" env:"GLAUTH_TRACING_SERVICE"` // TODO:
|
||||
}
|
||||
@@ -4,55 +4,9 @@ import (
|
||||
"context"
|
||||
)
|
||||
|
||||
// Debug defines the available debug configuration.
|
||||
type Debug struct {
|
||||
Addr string `ocisConfig:"addr" env:"GRAPH_EXPLORER_DEBUG_ADDR"`
|
||||
Token string `ocisConfig:"token" env:"GRAPH_EXPLORER_DEBUG_TOKEN"`
|
||||
Pprof bool `ocisConfig:"pprof" env:"GRAPH_EXPLORER_DEBUG_PPROF"`
|
||||
Zpages bool `ocisConfig:"zpages" env:"GRAPH_EXPLORER_DEBUG_ZPAGES"`
|
||||
}
|
||||
|
||||
// HTTP defines the available http configuration.
|
||||
type HTTP struct {
|
||||
Addr string `ocisConfig:"addr" env:"GRAPH_EXPLORER_HTTP_ADDR"`
|
||||
Root string `ocisConfig:"root" env:"GRAPH_EXPLORER_HTTP_ROOT"`
|
||||
Namespace string
|
||||
}
|
||||
|
||||
// Service defines the available service configuration.
|
||||
type Service struct {
|
||||
Name string
|
||||
Version string
|
||||
}
|
||||
|
||||
// Tracing defines the available tracing configuration.
|
||||
type Tracing struct {
|
||||
Enabled bool `ocisConfig:"enabled" env:"OCIS_TRACING_ENABLED;GRAPH_EXPLORER_TRACING_ENABLED"`
|
||||
Type string `ocisConfig:"type" env:"OCIS_TRACING_TYPE;GRAPH_EXPLORER_TRACING_TYPE"`
|
||||
Endpoint string `ocisConfig:"endpoint" env:"OCIS_TRACING_ENDPOINT;GRAPH_EXPLORER_TRACING_ENDPOINT"`
|
||||
Collector string `ocisConfig:"collector" env:"OCIS_TRACING_COLLECTOR;GRAPH_EXPLORER_TRACING_COLLECTOR"`
|
||||
Service string `ocisConfig:"service" env:"GRAPH_EXPLORER_TRACING_SERVICE"` //TODO: should this be an ID? or the same as Service.Name?
|
||||
}
|
||||
|
||||
// Log defines the available log configuration.
|
||||
type Log struct {
|
||||
Level string `mapstructure:"level" env:"OCIS_LOG_LEVEL;GRAPH_EXPLORER_LOG_LEVEL"`
|
||||
Pretty bool `mapstructure:"pretty" env:"OCIS_LOG_PRETTY;GRAPH_EXPLORER_LOG_PRETTY"`
|
||||
Color bool `mapstructure:"color" env:"OCIS_LOG_COLOR;GRAPH_EXPLORER_LOG_COLOR"`
|
||||
File string `mapstructure:"file" env:"OCIS_LOG_FILE;GRAPH_EXPLORER_LOG_FILE"`
|
||||
}
|
||||
|
||||
// GraphExplorer defines the available graph-explorer configuration.
|
||||
type GraphExplorer struct {
|
||||
ClientID string `ocisConfig:"client_id" env:"GRAPH_EXPLORER_CLIENT_ID"`
|
||||
Issuer string `ocisConfig:"issuer" env:"OCIS_URL;GRAPH_EXPLORER_ISSUER"`
|
||||
GraphURLBase string `ocisConfig:"graph_url_base" env:"OCIS_URL;GRAPH_EXPLORER_GRAPH_URL_BASE"`
|
||||
GraphURLPath string `ocisConfig:"graph_url_path" env:"GRAPH_EXPLORER_GRAPH_URL_PATH"`
|
||||
}
|
||||
|
||||
// Config combines all available configuration parts.
|
||||
type Config struct {
|
||||
Service Service `ocisConfig:"service"`
|
||||
Service Service
|
||||
|
||||
Tracing Tracing `ocisConfig:"tracing"`
|
||||
Log Log `ocisConfig:"log"`
|
||||
@@ -66,34 +20,10 @@ type Config struct {
|
||||
Supervised bool
|
||||
}
|
||||
|
||||
// DefaultConfig provides with a working version of a config.
|
||||
func DefaultConfig() *Config {
|
||||
return &Config{
|
||||
Debug: Debug{
|
||||
Addr: "127.0.0.1:9136",
|
||||
Token: "",
|
||||
Pprof: false,
|
||||
Zpages: false,
|
||||
},
|
||||
HTTP: HTTP{
|
||||
Addr: "127.0.0.1:9135",
|
||||
Root: "/graph-explorer",
|
||||
Namespace: "com.owncloud.web",
|
||||
},
|
||||
Service: Service{
|
||||
Name: "graph-explorer",
|
||||
},
|
||||
Tracing: Tracing{
|
||||
Type: "jaeger",
|
||||
Endpoint: "",
|
||||
Collector: "",
|
||||
Service: "graph-explorer",
|
||||
},
|
||||
GraphExplorer: GraphExplorer{
|
||||
ClientID: "ocis-explorer.js",
|
||||
Issuer: "https://localhost:9200",
|
||||
GraphURLBase: "https://localhost:9200",
|
||||
GraphURLPath: "/graph",
|
||||
},
|
||||
}
|
||||
// GraphExplorer defines the available graph-explorer configuration.
|
||||
type GraphExplorer struct {
|
||||
ClientID string `ocisConfig:"client_id" env:"GRAPH_EXPLORER_CLIENT_ID"`
|
||||
Issuer string `ocisConfig:"issuer" env:"OCIS_URL;GRAPH_EXPLORER_ISSUER"`
|
||||
GraphURLBase string `ocisConfig:"graph_url_base" env:"OCIS_URL;GRAPH_EXPLORER_GRAPH_URL_BASE"`
|
||||
GraphURLPath string `ocisConfig:"graph_url_path" env:"GRAPH_EXPLORER_GRAPH_URL_PATH"`
|
||||
}
|
||||
|
||||
9
graph-explorer/pkg/config/debug.go
Normal file
9
graph-explorer/pkg/config/debug.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package config
|
||||
|
||||
// Debug defines the available debug configuration.
|
||||
type Debug struct {
|
||||
Addr string `ocisConfig:"addr" env:"GRAPH_EXPLORER_DEBUG_ADDR"`
|
||||
Token string `ocisConfig:"token" env:"GRAPH_EXPLORER_DEBUG_TOKEN"`
|
||||
Pprof bool `ocisConfig:"pprof" env:"GRAPH_EXPLORER_DEBUG_PPROF"`
|
||||
Zpages bool `ocisConfig:"zpages" env:"GRAPH_EXPLORER_DEBUG_ZPAGES"`
|
||||
}
|
||||
32
graph-explorer/pkg/config/defaultconfig.go
Normal file
32
graph-explorer/pkg/config/defaultconfig.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package config
|
||||
|
||||
func DefaultConfig() *Config {
|
||||
return &Config{
|
||||
Debug: Debug{
|
||||
Addr: "127.0.0.1:9136",
|
||||
Token: "",
|
||||
Pprof: false,
|
||||
Zpages: false,
|
||||
},
|
||||
HTTP: HTTP{
|
||||
Addr: "127.0.0.1:9135",
|
||||
Root: "/graph-explorer",
|
||||
Namespace: "com.owncloud.web",
|
||||
},
|
||||
Service: Service{
|
||||
Name: "graph-explorer",
|
||||
},
|
||||
Tracing: Tracing{
|
||||
Type: "jaeger",
|
||||
Endpoint: "",
|
||||
Collector: "",
|
||||
Service: "graph-explorer",
|
||||
},
|
||||
GraphExplorer: GraphExplorer{
|
||||
ClientID: "ocis-explorer.js",
|
||||
Issuer: "https://localhost:9200",
|
||||
GraphURLBase: "https://localhost:9200",
|
||||
GraphURLPath: "/graph",
|
||||
},
|
||||
}
|
||||
}
|
||||
16
graph-explorer/pkg/config/http.go
Normal file
16
graph-explorer/pkg/config/http.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package config
|
||||
|
||||
// HTTP defines the available http configuration.
|
||||
type HTTP struct {
|
||||
Addr string `ocisConfig:"addr" env:"GRAPH_EXPLORER_HTTP_ADDR"`
|
||||
Root string `ocisConfig:"root" env:"GRAPH_EXPLORER_HTTP_ROOT"`
|
||||
Namespace string
|
||||
}
|
||||
|
||||
// CORS defines the available cors configuration.
|
||||
type CORS struct {
|
||||
AllowedOrigins []string `ocisConfig:"allowed_origins"`
|
||||
AllowedMethods []string `ocisConfig:"allowed_methods"`
|
||||
AllowedHeaders []string `ocisConfig:"allowed_headers"`
|
||||
AllowCredentials bool `ocisConfig:"allowed_credentials"`
|
||||
}
|
||||
9
graph-explorer/pkg/config/log.go
Normal file
9
graph-explorer/pkg/config/log.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package config
|
||||
|
||||
// Log defines the available log configuration.
|
||||
type Log struct {
|
||||
Level string `mapstructure:"level" env:"OCIS_LOG_LEVEL;GRAPH_EXPLORER_LOG_LEVEL"`
|
||||
Pretty bool `mapstructure:"pretty" env:"OCIS_LOG_PRETTY;GRAPH_EXPLORER_LOG_PRETTY"`
|
||||
Color bool `mapstructure:"color" env:"OCIS_LOG_COLOR;GRAPH_EXPLORER_LOG_COLOR"`
|
||||
File string `mapstructure:"file" env:"OCIS_LOG_FILE;GRAPH_EXPLORER_LOG_FILE"`
|
||||
}
|
||||
7
graph-explorer/pkg/config/service.go
Normal file
7
graph-explorer/pkg/config/service.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package config
|
||||
|
||||
// Service defines the available service configuration.
|
||||
type Service struct {
|
||||
Name string
|
||||
Version string
|
||||
}
|
||||
10
graph-explorer/pkg/config/tracing.go
Normal file
10
graph-explorer/pkg/config/tracing.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package config
|
||||
|
||||
// Tracing defines the available tracing configuration.
|
||||
type Tracing struct {
|
||||
Enabled bool `ocisConfig:"enabled" env:"OCIS_TRACING_ENABLED;GRAPH_EXPLORER_TRACING_ENABLED"`
|
||||
Type string `ocisConfig:"type" env:"OCIS_TRACING_TYPE;GRAPH_EXPLORER_TRACING_TYPE"`
|
||||
Endpoint string `ocisConfig:"endpoint" env:"OCIS_TRACING_ENDPOINT;GRAPH_EXPLORER_TRACING_ENDPOINT"`
|
||||
Collector string `ocisConfig:"collector" env:"OCIS_TRACING_COLLECTOR;GRAPH_EXPLORER_TRACING_COLLECTOR"`
|
||||
Service string `ocisConfig:"service" env:"GRAPH_EXPLORER_TRACING_SERVICE"` //TODO: should this be an ID? or the same as Service.Name?
|
||||
}
|
||||
@@ -2,56 +2,26 @@ package config
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/shared"
|
||||
)
|
||||
|
||||
// Debug defines the available debug configuration.
|
||||
type Debug struct {
|
||||
Addr string `ocisConfig:"addr" env:"GRAPH_DEBUG_ADDR"`
|
||||
Token string `ocisConfig:"token" env:"GRAPH_DEBUG_TOKEN"`
|
||||
Pprof bool `ocisConfig:"pprof" env:"GRAPH_DEBUG_PPROF"`
|
||||
Zpages bool `ocisConfig:"zpages" env:"GRAPH_DEBUG_ZPAGES"`
|
||||
}
|
||||
// Config combines all available configuration parts.
|
||||
type Config struct {
|
||||
Service Service
|
||||
|
||||
// HTTP defines the available http configuration.
|
||||
type HTTP struct {
|
||||
Addr string `ocisConfig:"addr" env:"GRAPH_HTTP_ADDR"`
|
||||
Namespace string
|
||||
Root string `ocisConfig:"root" env:"GRAPH_HTTP_ROOT"`
|
||||
}
|
||||
Tracing Tracing `ocisConfig:"tracing"`
|
||||
Log Log `ocisConfig:"log"`
|
||||
Debug Debug `ocisConfig:"debug"`
|
||||
|
||||
// Service defines the available service configuration.
|
||||
type Service struct {
|
||||
Name string
|
||||
Version string
|
||||
}
|
||||
HTTP HTTP `ocisConfig:"http"`
|
||||
|
||||
// Tracing defines the available tracing configuration.
|
||||
type Tracing struct {
|
||||
Enabled bool `ocisConfig:"enabled" env:"OCIS_TRACING_ENABLED;GRAPH_TRACING_ENABLED"`
|
||||
Type string `ocisConfig:"type" env:"OCIS_TRACING_TYPE;GRAPH_TRACING_TYPE"`
|
||||
Endpoint string `ocisConfig:"endpoint" env:"OCIS_TRACING_ENDPOINT;GRAPH_TRACING_ENDPOINT"`
|
||||
Collector string `ocisConfig:"collector" env:"OCIS_TRACING_COLLECTOR;GRAPH_TRACING_COLLECTOR"`
|
||||
Service string `ocisConfig:"service" env:"GRAPH_TRACING_SERVICE"` //TODO: should this be an ID? or the same as Service.Name?
|
||||
}
|
||||
Reva Reva `ocisConfig:"reva"`
|
||||
TokenManager TokenManager `ocisConfig:"token_manager"`
|
||||
|
||||
// Log defines the available log configuration.
|
||||
type Log struct {
|
||||
Level string `mapstructure:"level" env:"OCIS_LOG_LEVEL;GRAPH_LOG_LEVEL"`
|
||||
Pretty bool `mapstructure:"pretty" env:"OCIS_LOG_PRETTY;GRAPH_LOG_PRETTY"`
|
||||
Color bool `mapstructure:"color" env:"OCIS_LOG_COLOR;GRAPH_LOG_COLOR"`
|
||||
File string `mapstructure:"file" env:"OCIS_LOG_FILE;GRAPH_LOG_FILE"`
|
||||
}
|
||||
Spaces Spaces `ocisConfig:"spaces"`
|
||||
Identity Identity `ocisConfig:"identity"`
|
||||
|
||||
// Reva defines all available REVA configuration.
|
||||
type Reva struct {
|
||||
Address string `ocisConfig:"address" env:"REVA_GATEWAY"`
|
||||
}
|
||||
|
||||
// TokenManager is the config for using the reva token manager
|
||||
type TokenManager struct {
|
||||
JWTSecret string `ocisConfig:"jwt_secret" env:"OCIS_JWT_SECRET;GRAPH_JWT_SECRET"`
|
||||
Context context.Context
|
||||
Supervised bool
|
||||
}
|
||||
|
||||
type Spaces struct {
|
||||
@@ -85,80 +55,3 @@ type Identity struct {
|
||||
Backend string `ocisConfig:"backend" env:"GRAPH_IDENTITY_BACKEND"`
|
||||
LDAP LDAP `ocisConfig:"ldap"`
|
||||
}
|
||||
|
||||
// Config combines all available configuration parts.
|
||||
type Config struct {
|
||||
*shared.Commons
|
||||
|
||||
Service Service `ocisConfig:"service"`
|
||||
|
||||
Tracing Tracing `ocisConfig:"tracing"`
|
||||
Log Log `ocisConfig:"log"`
|
||||
Debug Debug `ocisConfig:"debug"`
|
||||
|
||||
HTTP HTTP `ocisConfig:"http"`
|
||||
|
||||
Reva Reva `ocisConfig:"reva"`
|
||||
TokenManager TokenManager `ocisConfig:"token_manager"`
|
||||
|
||||
Spaces Spaces `ocisConfig:"spaces"`
|
||||
Identity Identity `ocisConfig:"identity"`
|
||||
|
||||
Context context.Context
|
||||
Supervised bool
|
||||
}
|
||||
|
||||
func DefaultConfig() *Config {
|
||||
return &Config{
|
||||
Debug: Debug{
|
||||
Addr: "127.0.0.1:9124",
|
||||
Token: "",
|
||||
},
|
||||
HTTP: HTTP{
|
||||
Addr: "127.0.0.1:9120",
|
||||
Namespace: "com.owncloud.graph",
|
||||
Root: "/graph",
|
||||
},
|
||||
Service: Service{
|
||||
Name: "graph",
|
||||
},
|
||||
Tracing: Tracing{
|
||||
Enabled: false,
|
||||
Type: "jaeger",
|
||||
Service: "graph",
|
||||
},
|
||||
Reva: Reva{
|
||||
Address: "127.0.0.1:9142",
|
||||
},
|
||||
TokenManager: TokenManager{
|
||||
JWTSecret: "Pive-Fumkiu4",
|
||||
},
|
||||
Spaces: Spaces{
|
||||
WebDavBase: "https://localhost:9200",
|
||||
WebDavPath: "/dav/spaces/",
|
||||
DefaultQuota: "1000000000",
|
||||
},
|
||||
Identity: Identity{
|
||||
Backend: "cs3",
|
||||
LDAP: LDAP{
|
||||
URI: "ldap://localhost:9125",
|
||||
BindDN: "",
|
||||
BindPassword: "",
|
||||
UserBaseDN: "ou=users,dc=ocis,dc=test",
|
||||
UserSearchScope: "sub",
|
||||
UserFilter: "(objectClass=posixaccount)",
|
||||
UserEmailAttribute: "mail",
|
||||
UserDisplayNameAttribute: "displayName",
|
||||
UserNameAttribute: "uid",
|
||||
// FIXME: switch this to some more widely available attribute by default
|
||||
// ideally this needs to be constant for the lifetime of a users
|
||||
UserIDAttribute: "ownclouduuid",
|
||||
GroupBaseDN: "ou=groups,dc=ocis,dc=test",
|
||||
GroupSearchScope: "sub",
|
||||
GroupFilter: "(objectclass=groupOfNames)",
|
||||
GroupNameAttribute: "cn",
|
||||
GroupIDAttribute: "cn",
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
9
graph/pkg/config/debug.go
Normal file
9
graph/pkg/config/debug.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package config
|
||||
|
||||
// Debug defines the available debug configuration.
|
||||
type Debug struct {
|
||||
Addr string `ocisConfig:"addr" env:"GRAPH_DEBUG_ADDR"`
|
||||
Token string `ocisConfig:"token" env:"GRAPH_DEBUG_TOKEN"`
|
||||
Pprof bool `ocisConfig:"pprof" env:"GRAPH_DEBUG_PPROF"`
|
||||
Zpages bool `ocisConfig:"zpages" env:"GRAPH_DEBUG_ZPAGES"`
|
||||
}
|
||||
56
graph/pkg/config/defaultconfig.go
Normal file
56
graph/pkg/config/defaultconfig.go
Normal file
@@ -0,0 +1,56 @@
|
||||
package config
|
||||
|
||||
func DefaultConfig() *Config {
|
||||
return &Config{
|
||||
Debug: Debug{
|
||||
Addr: "127.0.0.1:9124",
|
||||
Token: "",
|
||||
},
|
||||
HTTP: HTTP{
|
||||
Addr: "127.0.0.1:9120",
|
||||
Namespace: "com.owncloud.graph",
|
||||
Root: "/graph",
|
||||
},
|
||||
Service: Service{
|
||||
Name: "graph",
|
||||
},
|
||||
Tracing: Tracing{
|
||||
Enabled: false,
|
||||
Type: "jaeger",
|
||||
Service: "graph",
|
||||
},
|
||||
Reva: Reva{
|
||||
Address: "127.0.0.1:9142",
|
||||
},
|
||||
TokenManager: TokenManager{
|
||||
JWTSecret: "Pive-Fumkiu4",
|
||||
},
|
||||
Spaces: Spaces{
|
||||
WebDavBase: "https://localhost:9200",
|
||||
WebDavPath: "/dav/spaces/",
|
||||
DefaultQuota: "1000000000",
|
||||
},
|
||||
Identity: Identity{
|
||||
Backend: "cs3",
|
||||
LDAP: LDAP{
|
||||
URI: "ldap://localhost:9125",
|
||||
BindDN: "",
|
||||
BindPassword: "",
|
||||
UserBaseDN: "ou=users,dc=ocis,dc=test",
|
||||
UserSearchScope: "sub",
|
||||
UserFilter: "(objectClass=posixaccount)",
|
||||
UserEmailAttribute: "mail",
|
||||
UserDisplayNameAttribute: "displayName",
|
||||
UserNameAttribute: "uid",
|
||||
// FIXME: switch this to some more widely available attribute by default
|
||||
// ideally this needs to be constant for the lifetime of a users
|
||||
UserIDAttribute: "ownclouduuid",
|
||||
GroupBaseDN: "ou=groups,dc=ocis,dc=test",
|
||||
GroupSearchScope: "sub",
|
||||
GroupFilter: "(objectclass=groupOfNames)",
|
||||
GroupNameAttribute: "cn",
|
||||
GroupIDAttribute: "cn",
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
8
graph/pkg/config/http.go
Normal file
8
graph/pkg/config/http.go
Normal file
@@ -0,0 +1,8 @@
|
||||
package config
|
||||
|
||||
// HTTP defines the available http configuration.
|
||||
type HTTP struct {
|
||||
Addr string `ocisConfig:"addr" env:"GRAPH_HTTP_ADDR"`
|
||||
Namespace string
|
||||
Root string `ocisConfig:"root" env:"GRAPH_HTTP_ROOT"`
|
||||
}
|
||||
9
graph/pkg/config/log.go
Normal file
9
graph/pkg/config/log.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package config
|
||||
|
||||
// Log defines the available log configuration.
|
||||
type Log struct {
|
||||
Level string `mapstructure:"level" env:"OCIS_LOG_LEVEL;GRAPH_LOG_LEVEL"`
|
||||
Pretty bool `mapstructure:"pretty" env:"OCIS_LOG_PRETTY;GRAPH_LOG_PRETTY"`
|
||||
Color bool `mapstructure:"color" env:"OCIS_LOG_COLOR;GRAPH_LOG_COLOR"`
|
||||
File string `mapstructure:"file" env:"OCIS_LOG_FILE;GRAPH_LOG_FILE"`
|
||||
}
|
||||
11
graph/pkg/config/reva.go
Normal file
11
graph/pkg/config/reva.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package config
|
||||
|
||||
// Reva defines all available REVA configuration.
|
||||
type Reva struct {
|
||||
Address string `ocisConfig:"address" env:"REVA_GATEWAY"`
|
||||
}
|
||||
|
||||
// TokenManager is the config for using the reva token manager
|
||||
type TokenManager struct {
|
||||
JWTSecret string `ocisConfig:"jwt_secret" env:"OCIS_JWT_SECRET;OCS_JWT_SECRET"`
|
||||
}
|
||||
7
graph/pkg/config/service.go
Normal file
7
graph/pkg/config/service.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package config
|
||||
|
||||
// Service defines the available service configuration.
|
||||
type Service struct {
|
||||
Name string
|
||||
Version string
|
||||
}
|
||||
10
graph/pkg/config/tracing.go
Normal file
10
graph/pkg/config/tracing.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package config
|
||||
|
||||
// Tracing defines the available tracing configuration.
|
||||
type Tracing struct {
|
||||
Enabled bool `ocisConfig:"enabled" env:"OCIS_TRACING_ENABLED;GRAPH_TRACING_ENABLED"`
|
||||
Type string `ocisConfig:"type" env:"OCIS_TRACING_TYPE;GRAPH_TRACING_TYPE"`
|
||||
Endpoint string `ocisConfig:"endpoint" env:"OCIS_TRACING_ENDPOINT;GRAPH_TRACING_ENDPOINT"`
|
||||
Collector string `ocisConfig:"collector" env:"OCIS_TRACING_COLLECTOR;GRAPH_TRACING_COLLECTOR"`
|
||||
Service string `ocisConfig:"service" env:"GRAPH_TRACING_SERVICE"` //TODO: should this be an ID? or the same as Service.Name?
|
||||
}
|
||||
@@ -2,35 +2,24 @@ package config
|
||||
|
||||
import (
|
||||
"context"
|
||||
"path"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/shared"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/config/defaults"
|
||||
)
|
||||
|
||||
// Debug defines the available debug configuration.
|
||||
type Debug struct {
|
||||
Addr string `ocisConfig:"addr" env:"IDP_DEBUG_ADDR"`
|
||||
Token string `ocisConfig:"token" env:"IDP_DEBUG_TOKEN"`
|
||||
Pprof bool `ocisConfig:"pprof" env:"IDP_DEBUG_PPROF"`
|
||||
Zpages bool `ocisConfig:"zpages" env:"IDP_DEBUG_ZPAGES"`
|
||||
}
|
||||
// Config combines all available configuration parts.
|
||||
type Config struct {
|
||||
Service Service
|
||||
|
||||
// HTTP defines the available http configuration.
|
||||
type HTTP struct {
|
||||
Addr string `ocisConfig:"addr" env:"IDP_HTTP_ADDR"`
|
||||
Root string `ocisConfig:"root" env:"IDP_HTTP_ROOT"`
|
||||
Namespace string
|
||||
TLSCert string `ocisConfig:"tls_cert" env:"IDP_TRANSPORT_TLS_CERT"`
|
||||
TLSKey string `ocisConfig:"tls_key" env:"IDP_TRANSPORT_TLS_KEY"`
|
||||
TLS bool `ocisConfig:"tls" env:"IDP_TLS"`
|
||||
}
|
||||
Tracing Tracing `ocisConfig:"tracing"`
|
||||
Log Log `ocisConfig:"log"`
|
||||
Debug Debug `ocisConfig:"debug"`
|
||||
|
||||
// Service defines the available service configuration.
|
||||
type Service struct {
|
||||
Name string
|
||||
Version string
|
||||
HTTP HTTP `ocisConfig:"http"`
|
||||
|
||||
Asset Asset `ocisConfig:"asset"`
|
||||
IDP Settings `ocisConfig:"idp"`
|
||||
Ldap Ldap `ocisConfig:"ldap"`
|
||||
|
||||
Context context.Context
|
||||
Supervised bool
|
||||
}
|
||||
|
||||
// Ldap defines the available LDAP configuration.
|
||||
@@ -52,23 +41,6 @@ type Ldap struct {
|
||||
Filter string `ocisConfig:"filter" env:"IDP_LDAP_FILTER"`
|
||||
}
|
||||
|
||||
// Tracing defines the available tracing configuration.
|
||||
type Tracing struct {
|
||||
Enabled bool `ocisConfig:"enabled" env:"OCIS_TRACING_ENABLED;IDP_TRACING_ENABLED"`
|
||||
Type string `ocisConfig:"type" env:"OCIS_TRACING_TYPE;IDP_TRACING_TYPE"`
|
||||
Endpoint string `ocisConfig:"endpoint" env:"OCIS_TRACING_ENDPOINT;IDP_TRACING_ENDPOINT"`
|
||||
Collector string `ocisConfig:"collector" env:"OCIS_TRACING_COLLECTOR;IDP_TRACING_COLLECTOR"`
|
||||
Service string `ocisConfig:"service" env:"IDP_TRACING_SERVICE"` //TODO: should this be an ID? or the same as Service.Name?
|
||||
}
|
||||
|
||||
// Log defines the available log configuration.
|
||||
type Log struct {
|
||||
Level string `mapstructure:"level" env:"OCIS_LOG_LEVEL;IDP_LOG_LEVEL"`
|
||||
Pretty bool `mapstructure:"pretty" env:"OCIS_LOG_PRETTY;IDP_LOG_PRETTY"`
|
||||
Color bool `mapstructure:"color" env:"OCIS_LOG_COLOR;IDP_LOG_COLOR"`
|
||||
File string `mapstructure:"file" env:"OCIS_LOG_FILE;IDP_LOG_FILE"`
|
||||
}
|
||||
|
||||
// Asset defines the available asset configuration.
|
||||
type Asset struct {
|
||||
Path string `ocisConfig:"asset" env:"IDP_ASSET_PATH"`
|
||||
@@ -123,95 +95,3 @@ type Settings struct {
|
||||
RefreshTokenDurationSeconds uint64 `ocisConfig:"refresh_token_duration_seconds" env:"IDP_REFRESH_TOKEN_EXPIRATION"`
|
||||
DyamicClientSecretDurationSeconds uint64 `ocisConfig:"dynamic_client_secret_duration_seconds" env:""`
|
||||
}
|
||||
|
||||
// Config combines all available configuration parts.
|
||||
type Config struct {
|
||||
*shared.Commons
|
||||
|
||||
Service Service `ocisConfig:"service"`
|
||||
|
||||
Tracing Tracing `ocisConfig:"tracing"`
|
||||
Log Log `ocisConfig:"log"`
|
||||
Debug Debug `ocisConfig:"debug"`
|
||||
|
||||
HTTP HTTP `ocisConfig:"http"`
|
||||
|
||||
Asset Asset `ocisConfig:"asset"`
|
||||
IDP Settings `ocisConfig:"idp"`
|
||||
Ldap Ldap `ocisConfig:"ldap"`
|
||||
|
||||
Context context.Context
|
||||
Supervised bool
|
||||
}
|
||||
|
||||
func DefaultConfig() *Config {
|
||||
return &Config{
|
||||
Debug: Debug{
|
||||
Addr: "127.0.0.1:9134",
|
||||
},
|
||||
HTTP: HTTP{
|
||||
Addr: "127.0.0.1:9130",
|
||||
Root: "/",
|
||||
Namespace: "com.owncloud.web",
|
||||
TLSCert: path.Join(defaults.BaseDataPath(), "idp", "server.crt"),
|
||||
TLSKey: path.Join(defaults.BaseDataPath(), "idp", "server.key"),
|
||||
TLS: false,
|
||||
},
|
||||
Service: Service{
|
||||
Name: "idp",
|
||||
},
|
||||
Tracing: Tracing{
|
||||
Type: "jaeger",
|
||||
Endpoint: "",
|
||||
Collector: "",
|
||||
Service: "idp",
|
||||
},
|
||||
Asset: Asset{},
|
||||
IDP: Settings{
|
||||
Iss: "https://localhost:9200",
|
||||
IdentityManager: "ldap",
|
||||
URIBasePath: "",
|
||||
SignInURI: "",
|
||||
SignedOutURI: "",
|
||||
AuthorizationEndpointURI: "",
|
||||
EndsessionEndpointURI: "",
|
||||
Insecure: false,
|
||||
TrustedProxy: nil,
|
||||
AllowScope: nil,
|
||||
AllowClientGuests: false,
|
||||
AllowDynamicClientRegistration: false,
|
||||
EncryptionSecretFile: "",
|
||||
Listen: "",
|
||||
IdentifierClientDisabled: true,
|
||||
IdentifierClientPath: path.Join(defaults.BaseDataPath(), "idp"),
|
||||
IdentifierRegistrationConf: path.Join(defaults.BaseDataPath(), "idp", "identifier-registration.yaml"),
|
||||
IdentifierScopesConf: "",
|
||||
IdentifierDefaultBannerLogo: "",
|
||||
IdentifierDefaultSignInPageText: "",
|
||||
IdentifierDefaultUsernameHintText: "",
|
||||
SigningKid: "",
|
||||
SigningMethod: "PS256",
|
||||
SigningPrivateKeyFiles: nil,
|
||||
ValidationKeysPath: "",
|
||||
CookieBackendURI: "",
|
||||
CookieNames: nil,
|
||||
AccessTokenDurationSeconds: 60 * 10, // 10 minutes
|
||||
IDTokenDurationSeconds: 60 * 60, // 1 hour
|
||||
RefreshTokenDurationSeconds: 60 * 60 * 24 * 365 * 3, // 1 year
|
||||
DyamicClientSecretDurationSeconds: 0,
|
||||
},
|
||||
Ldap: Ldap{
|
||||
URI: "ldap://localhost:9125",
|
||||
BindDN: "cn=idp,ou=sysusers,dc=ocis,dc=test",
|
||||
BindPassword: "idp",
|
||||
BaseDN: "ou=users,dc=ocis,dc=test",
|
||||
Scope: "sub",
|
||||
LoginAttribute: "cn",
|
||||
EmailAttribute: "mail",
|
||||
NameAttribute: "sn",
|
||||
UUIDAttribute: "uid",
|
||||
UUIDAttributeType: "text",
|
||||
Filter: "(objectClass=posixaccount)",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
9
idp/pkg/config/debug.go
Normal file
9
idp/pkg/config/debug.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package config
|
||||
|
||||
// Debug defines the available debug configuration.
|
||||
type Debug struct {
|
||||
Addr string `ocisConfig:"addr" env:"IDP_DEBUG_ADDR"`
|
||||
Token string `ocisConfig:"token" env:"IDP_DEBUG_TOKEN"`
|
||||
Pprof bool `ocisConfig:"pprof" env:"IDP_DEBUG_PPROF"`
|
||||
Zpages bool `ocisConfig:"zpages" env:"IDP_DEBUG_ZPAGES"`
|
||||
}
|
||||
79
idp/pkg/config/defaultconfig.go
Normal file
79
idp/pkg/config/defaultconfig.go
Normal file
@@ -0,0 +1,79 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"path"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/config/defaults"
|
||||
)
|
||||
|
||||
func DefaultConfig() *Config {
|
||||
return &Config{
|
||||
Debug: Debug{
|
||||
Addr: "127.0.0.1:9134",
|
||||
},
|
||||
HTTP: HTTP{
|
||||
Addr: "127.0.0.1:9130",
|
||||
Root: "/",
|
||||
Namespace: "com.owncloud.web",
|
||||
TLSCert: path.Join(defaults.BaseDataPath(), "idp", "server.crt"),
|
||||
TLSKey: path.Join(defaults.BaseDataPath(), "idp", "server.key"),
|
||||
TLS: false,
|
||||
},
|
||||
Service: Service{
|
||||
Name: "idp",
|
||||
},
|
||||
Tracing: Tracing{
|
||||
Type: "jaeger",
|
||||
Endpoint: "",
|
||||
Collector: "",
|
||||
Service: "idp",
|
||||
},
|
||||
Asset: Asset{},
|
||||
IDP: Settings{
|
||||
Iss: "https://localhost:9200",
|
||||
IdentityManager: "ldap",
|
||||
URIBasePath: "",
|
||||
SignInURI: "",
|
||||
SignedOutURI: "",
|
||||
AuthorizationEndpointURI: "",
|
||||
EndsessionEndpointURI: "",
|
||||
Insecure: false,
|
||||
TrustedProxy: nil,
|
||||
AllowScope: nil,
|
||||
AllowClientGuests: false,
|
||||
AllowDynamicClientRegistration: false,
|
||||
EncryptionSecretFile: "",
|
||||
Listen: "",
|
||||
IdentifierClientDisabled: true,
|
||||
IdentifierClientPath: path.Join(defaults.BaseDataPath(), "idp"),
|
||||
IdentifierRegistrationConf: path.Join(defaults.BaseDataPath(), "idp", "identifier-registration.yaml"),
|
||||
IdentifierScopesConf: "",
|
||||
IdentifierDefaultBannerLogo: "",
|
||||
IdentifierDefaultSignInPageText: "",
|
||||
IdentifierDefaultUsernameHintText: "",
|
||||
SigningKid: "",
|
||||
SigningMethod: "PS256",
|
||||
SigningPrivateKeyFiles: nil,
|
||||
ValidationKeysPath: "",
|
||||
CookieBackendURI: "",
|
||||
CookieNames: nil,
|
||||
AccessTokenDurationSeconds: 60 * 10, // 10 minutes
|
||||
IDTokenDurationSeconds: 60 * 60, // 1 hour
|
||||
RefreshTokenDurationSeconds: 60 * 60 * 24 * 365 * 3, // 1 year
|
||||
DyamicClientSecretDurationSeconds: 0,
|
||||
},
|
||||
Ldap: Ldap{
|
||||
URI: "ldap://localhost:9125",
|
||||
BindDN: "cn=idp,ou=sysusers,dc=ocis,dc=test",
|
||||
BindPassword: "idp",
|
||||
BaseDN: "ou=users,dc=ocis,dc=test",
|
||||
Scope: "sub",
|
||||
LoginAttribute: "cn",
|
||||
EmailAttribute: "mail",
|
||||
NameAttribute: "sn",
|
||||
UUIDAttribute: "uid",
|
||||
UUIDAttributeType: "text",
|
||||
Filter: "(objectClass=posixaccount)",
|
||||
},
|
||||
}
|
||||
}
|
||||
11
idp/pkg/config/http.go
Normal file
11
idp/pkg/config/http.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package config
|
||||
|
||||
// HTTP defines the available http configuration.
|
||||
type HTTP struct {
|
||||
Addr string `ocisConfig:"addr" env:"IDP_HTTP_ADDR"`
|
||||
Root string `ocisConfig:"root" env:"IDP_HTTP_ROOT"`
|
||||
Namespace string
|
||||
TLSCert string `ocisConfig:"tls_cert" env:"IDP_TRANSPORT_TLS_CERT"`
|
||||
TLSKey string `ocisConfig:"tls_key" env:"IDP_TRANSPORT_TLS_KEY"`
|
||||
TLS bool `ocisConfig:"tls" env:"IDP_TLS"`
|
||||
}
|
||||
9
idp/pkg/config/log.go
Normal file
9
idp/pkg/config/log.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package config
|
||||
|
||||
// Log defines the available log configuration.
|
||||
type Log struct {
|
||||
Level string `mapstructure:"level" env:"OCIS_LOG_LEVEL;IDP_LOG_LEVEL"`
|
||||
Pretty bool `mapstructure:"pretty" env:"OCIS_LOG_PRETTY;IDP_LOG_PRETTY"`
|
||||
Color bool `mapstructure:"color" env:"OCIS_LOG_COLOR;IDP_LOG_COLOR"`
|
||||
File string `mapstructure:"file" env:"OCIS_LOG_FILE;IDP_LOG_FILE"`
|
||||
}
|
||||
7
idp/pkg/config/service.go
Normal file
7
idp/pkg/config/service.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package config
|
||||
|
||||
// Service defines the available service configuration.
|
||||
type Service struct {
|
||||
Name string
|
||||
Version string
|
||||
}
|
||||
10
idp/pkg/config/tracing.go
Normal file
10
idp/pkg/config/tracing.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package config
|
||||
|
||||
// Tracing defines the available tracing configuration.
|
||||
type Tracing struct {
|
||||
Enabled bool `ocisConfig:"enabled" env:"OCIS_TRACING_ENABLED;IDP_TRACING_ENABLED"`
|
||||
Type string `ocisConfig:"type" env:"OCIS_TRACING_TYPE;IDP_TRACING_TYPE"`
|
||||
Endpoint string `ocisConfig:"endpoint" env:"OCIS_TRACING_ENDPOINT;IDP_TRACING_ENDPOINT"`
|
||||
Collector string `ocisConfig:"collector" env:"OCIS_TRACING_COLLECTOR;IDP_TRACING_COLLECTOR"`
|
||||
Service string `ocisConfig:"service" env:"IDP_TRACING_SERVICE"` //TODO: should this be an ID? or the same as Service.Name?
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
acccfg "github.com/owncloud/ocis/accounts/pkg/config"
|
||||
)
|
||||
|
||||
//TODO: remove?
|
||||
// Config represents cs3conf. Should be deprecated in favor of config.Config.
|
||||
type Config struct {
|
||||
ProviderAddr string
|
||||
|
||||
@@ -18,9 +18,9 @@ func GLAuthCommand(cfg *config.Config) *cli.Command {
|
||||
return err
|
||||
}
|
||||
|
||||
if cfg.Commons != nil {
|
||||
cfg.GLAuth.Commons = cfg.Commons
|
||||
}
|
||||
//if cfg.Commons != nil {
|
||||
// cfg.GLAuth.Commons = cfg.Commons
|
||||
//}
|
||||
|
||||
return nil
|
||||
},
|
||||
|
||||
@@ -18,9 +18,9 @@ func GraphCommand(cfg *config.Config) *cli.Command {
|
||||
return err
|
||||
}
|
||||
|
||||
if cfg.Commons != nil {
|
||||
cfg.Graph.Commons = cfg.Commons
|
||||
}
|
||||
//if cfg.Commons != nil {
|
||||
// cfg.Graph.Commons = cfg.Commons
|
||||
//}
|
||||
|
||||
return nil
|
||||
},
|
||||
|
||||
@@ -18,9 +18,9 @@ func GraphExplorerCommand(cfg *config.Config) *cli.Command {
|
||||
return err
|
||||
}
|
||||
|
||||
if cfg.Commons != nil {
|
||||
cfg.Graph.Commons = cfg.Commons
|
||||
}
|
||||
//if cfg.Commons != nil {
|
||||
// cfg.Graph.Commons = cfg.Commons
|
||||
//}
|
||||
|
||||
return nil
|
||||
},
|
||||
|
||||
@@ -21,9 +21,9 @@ func IDPCommand(cfg *config.Config) *cli.Command {
|
||||
return err
|
||||
}
|
||||
|
||||
if cfg.Commons != nil {
|
||||
cfg.IDP.Commons = cfg.Commons
|
||||
}
|
||||
//if cfg.Commons != nil {
|
||||
// cfg.IDP.Commons = cfg.Commons
|
||||
//}
|
||||
|
||||
return nil
|
||||
},
|
||||
|
||||
@@ -18,9 +18,9 @@ func OCSCommand(cfg *config.Config) *cli.Command {
|
||||
return err
|
||||
}
|
||||
|
||||
if cfg.Commons != nil {
|
||||
cfg.OCS.Commons = cfg.Commons
|
||||
}
|
||||
//if cfg.Commons != nil {
|
||||
// cfg.OCS.Commons = cfg.Commons
|
||||
//}
|
||||
|
||||
return nil
|
||||
},
|
||||
|
||||
@@ -21,9 +21,9 @@ func ProxyCommand(cfg *config.Config) *cli.Command {
|
||||
return err
|
||||
}
|
||||
|
||||
if cfg.Commons != nil {
|
||||
cfg.Proxy.Commons = cfg.Commons
|
||||
}
|
||||
//if cfg.Commons != nil {
|
||||
// cfg.Proxy.Commons = cfg.Commons
|
||||
//}
|
||||
|
||||
return nil
|
||||
},
|
||||
|
||||
@@ -21,9 +21,9 @@ func SettingsCommand(cfg *config.Config) *cli.Command {
|
||||
return err
|
||||
}
|
||||
|
||||
if cfg.Commons != nil {
|
||||
cfg.Settings.Commons = cfg.Commons
|
||||
}
|
||||
//if cfg.Commons != nil {
|
||||
// cfg.Settings.Commons = cfg.Commons
|
||||
//}
|
||||
|
||||
return nil
|
||||
},
|
||||
|
||||
@@ -22,9 +22,9 @@ func WebDAVCommand(cfg *config.Config) *cli.Command {
|
||||
return err
|
||||
}
|
||||
|
||||
if cfg.Commons != nil {
|
||||
cfg.WebDAV.Commons = cfg.Commons
|
||||
}
|
||||
//if cfg.Commons != nil {
|
||||
// cfg.WebDAV.Commons = cfg.Commons
|
||||
//}
|
||||
|
||||
return nil
|
||||
},
|
||||
|
||||
@@ -2,79 +2,11 @@ package config
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/shared"
|
||||
)
|
||||
|
||||
// Debug defines the available debug configuration.
|
||||
type Debug struct {
|
||||
Addr string `ocisConfig:"addr" env:"OCS_DEBUG_ADDR"`
|
||||
Token string `ocisConfig:"token" env:"OCS_DEBUG_TOKEN"`
|
||||
Pprof bool `ocisConfig:"pprof" env:"OCS_DEBUG_PPROF"`
|
||||
Zpages bool `ocisConfig:"zpages" env:"OCS_DEBUG_ZPAGES"`
|
||||
}
|
||||
|
||||
// CORS defines the available cors configuration.
|
||||
type CORS struct {
|
||||
AllowedOrigins []string `ocisConfig:"allowed_origins"`
|
||||
AllowedMethods []string `ocisConfig:"allowed_methods"`
|
||||
AllowedHeaders []string `ocisConfig:"allowed_headers"`
|
||||
AllowCredentials bool `ocisConfig:"allow_credentials"`
|
||||
}
|
||||
|
||||
// HTTP defines the available http configuration.
|
||||
type HTTP struct {
|
||||
Addr string `ocisConfig:"addr" env:"OCS_HTTP_ADDR"`
|
||||
Root string `ocisConfig:"root" env:"OCS_HTTP_ROOT"`
|
||||
Namespace string
|
||||
CORS CORS `ocisConfig:"cors"`
|
||||
}
|
||||
|
||||
// Service defines the available service configuration.
|
||||
type Service struct {
|
||||
Name string
|
||||
Version string
|
||||
}
|
||||
|
||||
// Tracing defines the available tracing configuration.
|
||||
type Tracing struct {
|
||||
Enabled bool `ocisConfig:"enabled" env:"OCIS_TRACING_ENABLED;OCS_TRACING_ENABLED"`
|
||||
Type string `ocisConfig:"type" env:"OCIS_TRACING_TYPE;OCS_TRACING_TYPE"`
|
||||
Endpoint string `ocisConfig:"endpoint" env:"OCIS_TRACING_ENDPOINT;OCS_TRACING_ENDPOINT"`
|
||||
Collector string `ocisConfig:"collector" env:"OCIS_TRACING_COLLECTOR;OCS_TRACING_COLLECTOR"`
|
||||
Service string `ocisConfig:"service" env:"OCS_TRACING_SERVICE"`
|
||||
}
|
||||
|
||||
// Log defines the available log configuration.
|
||||
type Log struct {
|
||||
Level string `mapstructure:"level" env:"OCIS_LOG_LEVEL;OCS_LOG_LEVEL"`
|
||||
Pretty bool `mapstructure:"pretty" env:"OCIS_LOG_PRETTY;OCS_LOG_PRETTY"`
|
||||
Color bool `mapstructure:"color" env:"OCIS_LOG_COLOR;OCS_LOG_COLOR"`
|
||||
File string `mapstructure:"file" env:"OCIS_LOG_FILE;OCS_LOG_FILE"`
|
||||
}
|
||||
|
||||
// Reva defines all available REVA configuration.
|
||||
type Reva struct {
|
||||
Address string `ocisConfig:"address" env:"REVA_GATEWAY"`
|
||||
}
|
||||
|
||||
// TokenManager is the config for using the reva token manager
|
||||
type TokenManager struct {
|
||||
JWTSecret string `ocisConfig:"jwt_secret" env:"OCIS_JWT_SECRET;OCS_JWT_SECRET"`
|
||||
}
|
||||
|
||||
// IdentityManagement keeps track of the OIDC address. This is because Reva requisite of uniqueness for users
|
||||
// is based in the combination of IDP hostname + UserID. For more information see:
|
||||
// https://github.com/cs3org/reva/blob/4fd0229f13fae5bc9684556a82dbbd0eced65ef9/pkg/storage/utils/decomposedfs/node/node.go#L856-L865
|
||||
type IdentityManagement struct {
|
||||
Address string `ocisConfig:"address" env:"OCIS_URL;OCS_IDM_ADDRESS"`
|
||||
}
|
||||
|
||||
// Config combines all available configuration parts.
|
||||
type Config struct {
|
||||
*shared.Commons
|
||||
|
||||
Service Service `ocisConfig:"service"`
|
||||
Service Service
|
||||
|
||||
Tracing Tracing `ocisConfig:"tracing"`
|
||||
Log Log `ocisConfig:"log"`
|
||||
@@ -95,45 +27,9 @@ type Config struct {
|
||||
Supervised bool
|
||||
}
|
||||
|
||||
// DefaultConfig provides default values for a config struct.
|
||||
func DefaultConfig() *Config {
|
||||
return &Config{
|
||||
Debug: Debug{
|
||||
Addr: "127.0.0.1:9114",
|
||||
Token: "",
|
||||
Pprof: false,
|
||||
Zpages: false,
|
||||
},
|
||||
HTTP: HTTP{
|
||||
Addr: "127.0.0.1:9110",
|
||||
Root: "/ocs",
|
||||
Namespace: "com.owncloud.web",
|
||||
CORS: CORS{
|
||||
AllowedOrigins: []string{"*"},
|
||||
AllowedMethods: []string{"GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"},
|
||||
AllowedHeaders: []string{"Authorization", "Origin", "Content-Type", "Accept", "X-Requested-With"},
|
||||
AllowCredentials: true,
|
||||
},
|
||||
},
|
||||
Service: Service{
|
||||
Name: "ocs",
|
||||
},
|
||||
Tracing: Tracing{
|
||||
Enabled: false,
|
||||
Type: "jaeger",
|
||||
Endpoint: "",
|
||||
Collector: "",
|
||||
Service: "ocs",
|
||||
},
|
||||
TokenManager: TokenManager{
|
||||
JWTSecret: "Pive-Fumkiu4",
|
||||
},
|
||||
AccountBackend: "accounts",
|
||||
Reva: Reva{Address: "127.0.0.1:9142"},
|
||||
StorageUsersDriver: "ocis",
|
||||
MachineAuthAPIKey: "change-me-please",
|
||||
IdentityManagement: IdentityManagement{
|
||||
Address: "https://localhost:9200",
|
||||
},
|
||||
}
|
||||
// IdentityManagement keeps track of the OIDC address. This is because Reva requisite of uniqueness for users
|
||||
// is based in the combination of IDP hostname + UserID. For more information see:
|
||||
// https://github.com/cs3org/reva/blob/4fd0229f13fae5bc9684556a82dbbd0eced65ef9/pkg/storage/utils/decomposedfs/node/node.go#L856-L865
|
||||
type IdentityManagement struct {
|
||||
Address string `ocisConfig:"address" env:"OCIS_URL;OCS_IDM_ADDRESS"`
|
||||
}
|
||||
|
||||
9
ocs/pkg/config/debug.go
Normal file
9
ocs/pkg/config/debug.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package config
|
||||
|
||||
// Debug defines the available debug configuration.
|
||||
type Debug struct {
|
||||
Addr string `ocisConfig:"addr" env:"OCS_DEBUG_ADDR"`
|
||||
Token string `ocisConfig:"token" env:"OCS_DEBUG_TOKEN"`
|
||||
Pprof bool `ocisConfig:"pprof" env:"OCS_DEBUG_PPROF"`
|
||||
Zpages bool `ocisConfig:"zpages" env:"OCS_DEBUG_ZPAGES"`
|
||||
}
|
||||
43
ocs/pkg/config/defaultconfig.go
Normal file
43
ocs/pkg/config/defaultconfig.go
Normal file
@@ -0,0 +1,43 @@
|
||||
package config
|
||||
|
||||
func DefaultConfig() *Config {
|
||||
return &Config{
|
||||
Debug: Debug{
|
||||
Addr: "127.0.0.1:9114",
|
||||
Token: "",
|
||||
Pprof: false,
|
||||
Zpages: false,
|
||||
},
|
||||
HTTP: HTTP{
|
||||
Addr: "127.0.0.1:9110",
|
||||
Root: "/ocs",
|
||||
Namespace: "com.owncloud.web",
|
||||
CORS: CORS{
|
||||
AllowedOrigins: []string{"*"},
|
||||
AllowedMethods: []string{"GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"},
|
||||
AllowedHeaders: []string{"Authorization", "Origin", "Content-Type", "Accept", "X-Requested-With"},
|
||||
AllowCredentials: true,
|
||||
},
|
||||
},
|
||||
Service: Service{
|
||||
Name: "ocs",
|
||||
},
|
||||
Tracing: Tracing{
|
||||
Enabled: false,
|
||||
Type: "jaeger",
|
||||
Endpoint: "",
|
||||
Collector: "",
|
||||
Service: "ocs",
|
||||
},
|
||||
TokenManager: TokenManager{
|
||||
JWTSecret: "Pive-Fumkiu4",
|
||||
},
|
||||
AccountBackend: "accounts",
|
||||
Reva: Reva{Address: "127.0.0.1:9142"},
|
||||
StorageUsersDriver: "ocis",
|
||||
MachineAuthAPIKey: "change-me-please",
|
||||
IdentityManagement: IdentityManagement{
|
||||
Address: "https://localhost:9200",
|
||||
},
|
||||
}
|
||||
}
|
||||
17
ocs/pkg/config/http.go
Normal file
17
ocs/pkg/config/http.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package config
|
||||
|
||||
// HTTP defines the available http configuration.
|
||||
type HTTP struct {
|
||||
Addr string `ocisConfig:"addr" env:"OCS_HTTP_ADDR"`
|
||||
Root string `ocisConfig:"root" env:"OCS_HTTP_ROOT"`
|
||||
Namespace string
|
||||
CORS CORS `ocisConfig:"cors"`
|
||||
}
|
||||
|
||||
// CORS defines the available cors configuration.
|
||||
type CORS struct {
|
||||
AllowedOrigins []string `ocisConfig:"allowed_origins"`
|
||||
AllowedMethods []string `ocisConfig:"allowed_methods"`
|
||||
AllowedHeaders []string `ocisConfig:"allowed_headers"`
|
||||
AllowCredentials bool `ocisConfig:"allowed_credentials"`
|
||||
}
|
||||
9
ocs/pkg/config/log.go
Normal file
9
ocs/pkg/config/log.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package config
|
||||
|
||||
// Log defines the available log configuration.
|
||||
type Log struct {
|
||||
Level string `mapstructure:"level" env:"OCIS_LOG_LEVEL;OCS_LOG_LEVEL"`
|
||||
Pretty bool `mapstructure:"pretty" env:"OCIS_LOG_PRETTY;OCS_LOG_PRETTY"`
|
||||
Color bool `mapstructure:"color" env:"OCIS_LOG_COLOR;OCS_LOG_COLOR"`
|
||||
File string `mapstructure:"file" env:"OCIS_LOG_FILE;OCS_LOG_FILE"`
|
||||
}
|
||||
11
ocs/pkg/config/reva.go
Normal file
11
ocs/pkg/config/reva.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package config
|
||||
|
||||
// Reva defines all available REVA configuration.
|
||||
type Reva struct {
|
||||
Address string `ocisConfig:"address" env:"REVA_GATEWAY"`
|
||||
}
|
||||
|
||||
// TokenManager is the config for using the reva token manager
|
||||
type TokenManager struct {
|
||||
JWTSecret string `ocisConfig:"jwt_secret" env:"OCIS_JWT_SECRET;OCS_JWT_SECRET"`
|
||||
}
|
||||
7
ocs/pkg/config/service.go
Normal file
7
ocs/pkg/config/service.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package config
|
||||
|
||||
// Service defines the available service configuration.
|
||||
type Service struct {
|
||||
Name string
|
||||
Version string
|
||||
}
|
||||
10
ocs/pkg/config/tracing.go
Normal file
10
ocs/pkg/config/tracing.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package config
|
||||
|
||||
// Tracing defines the available tracing configuration.
|
||||
type Tracing struct {
|
||||
Enabled bool `ocisConfig:"enabled" env:"OCIS_TRACING_ENABLED;OCS_TRACING_ENABLED"`
|
||||
Type string `ocisConfig:"type" env:"OCIS_TRACING_TYPE;OCS_TRACING_TYPE"`
|
||||
Endpoint string `ocisConfig:"endpoint" env:"OCIS_TRACING_ENDPOINT;OCS_TRACING_ENDPOINT"`
|
||||
Collector string `ocisConfig:"collector" env:"OCIS_TRACING_COLLECTOR;OCS_TRACING_COLLECTOR"`
|
||||
Service string `ocisConfig:"service" env:"OCS_TRACING_SERVICE"`
|
||||
}
|
||||
@@ -1,52 +1,33 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"context"
|
||||
"path"
|
||||
import "context"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/config/defaults"
|
||||
"github.com/owncloud/ocis/ocis-pkg/shared"
|
||||
)
|
||||
// Config combines all available configuration parts.
|
||||
type Config struct {
|
||||
Service Service
|
||||
|
||||
// Log defines the available log configuration.
|
||||
type Log struct {
|
||||
Level string `mapstructure:"level" env:"OCIS_LOG_LEVEL;PROXY_LOG_LEVEL"`
|
||||
Pretty bool `mapstructure:"pretty" env:"OCIS_LOG_PRETTY;PROXY_LOG_PRETTY"`
|
||||
Color bool `mapstructure:"color" env:"OCIS_LOG_COLOR;PROXY_LOG_COLOR"`
|
||||
File string `mapstructure:"file" env:"OCIS_LOG_FILE;PROXY_LOG_FILE"`
|
||||
}
|
||||
Tracing Tracing `ocisConfig:"tracing"`
|
||||
Log Log `ocisConfig:"log"`
|
||||
Debug Debug `ocisConfig:"debug"`
|
||||
|
||||
// Debug defines the available debug configuration.
|
||||
type Debug struct {
|
||||
Addr string `ocisConfig:"addr" env:"PROXY_DEBUG_ADDR"`
|
||||
Token string `ocisConfig:"token" env:"PROXY_DEBUG_TOKEN"`
|
||||
Pprof bool `ocisConfig:"pprof" env:"PROXY_DEBUG_PPROF"`
|
||||
Zpages bool `ocisConfig:"zpages" env:"PROXY_DEBUG_ZPAGES"`
|
||||
}
|
||||
HTTP HTTP `ocisConfig:"http"`
|
||||
|
||||
// HTTP defines the available http configuration.
|
||||
type HTTP struct {
|
||||
Addr string `ocisConfig:"addr" env:"PROXY_HTTP_ADDR"`
|
||||
Root string `ocisConfig:"root" env:"PROXY_HTTP_ROOT"`
|
||||
Namespace string
|
||||
TLSCert string `ocisConfig:"tls_cert" env:"PROXY_TRANSPORT_TLS_CERT"`
|
||||
TLSKey string `ocisConfig:"tls_key" env:"PROXY_TRANSPORT_TLS_KEY"`
|
||||
TLS bool `ocisConfig:"tls" env:"PROXY_TLS"`
|
||||
}
|
||||
Policies []Policy `ocisConfig:"policies"`
|
||||
OIDC OIDC `ocisConfig:"oidc"`
|
||||
TokenManager TokenManager `ocisConfig:"token_manager"`
|
||||
PolicySelector *PolicySelector `ocisConfig:"policy_selector"`
|
||||
Reva Reva `ocisConfig:"reva"`
|
||||
PreSignedURL PreSignedURL `ocisConfig:"pre_signed_url"`
|
||||
AccountBackend string `ocisConfig:"account_backend" env:"PROXY_ACCOUNT_BACKEND_TYPE"`
|
||||
UserOIDCClaim string `ocisConfig:"user_oidc_claim" env:"PROXY_USER_OIDC_CLAIM"`
|
||||
UserCS3Claim string `ocisConfig:"user_cs3_claim" env:"PROXY_USER_CS3_CLAIM"`
|
||||
MachineAuthAPIKey string `ocisConfig:"machine_auth_api_key" env:"OCIS_MACHINE_AUTH_API_KEY;PROXY_MACHINE_AUTH_API_KEY"`
|
||||
AutoprovisionAccounts bool `ocisConfig:"auto_provision_accounts" env:"PROXY_AUTOPROVISION_ACCOUNTS"`
|
||||
EnableBasicAuth bool `ocisConfig:"enable_basic_auth" env:"PROXY_ENABLE_BASIC_AUTH"`
|
||||
InsecureBackends bool `ocisConfig:"insecure_backends" env:"PROXY_INSECURE_BACKENDS"`
|
||||
|
||||
// Service defines the available service configuration.
|
||||
type Service struct {
|
||||
Name string
|
||||
Version string
|
||||
}
|
||||
|
||||
// Tracing defines the available tracing configuration.
|
||||
type Tracing struct {
|
||||
Enabled bool `ocisConfig:"enabled" env:"OCIS_TRACING_ENABLED;PROXY_TRACING_ENABLED"`
|
||||
Type string `ocisConfig:"type" env:"OCIS_TRACING_TYPE;PROXY_TRACING_TYPE"`
|
||||
Endpoint string `ocisConfig:"endpoint" env:"OCIS_TRACING_ENDPOINT;PROXY_TRACING_ENDPOINT"`
|
||||
Collector string `ocisConfig:"collector" env:"OCIS_TRACING_COLLECTOR;PROXY_TRACING_COLLECTOR"`
|
||||
Service string `ocisConfig:"service" env:"PROXY_TRACING_SERVICE"` //TODO: should this be an ID? or the same as Service.Name?
|
||||
Context context.Context
|
||||
Supervised bool
|
||||
}
|
||||
|
||||
// Policy enables us to use multiple directors.
|
||||
@@ -82,6 +63,7 @@ var (
|
||||
RouteTypes = []RouteType{QueryRoute, RegexRoute, PrefixRoute}
|
||||
)
|
||||
|
||||
// TODO: use reva config here
|
||||
// Reva defines all available REVA configuration.
|
||||
type Reva struct {
|
||||
Address string `ocisConfig:"address" env:"REVA_GATEWAY"`
|
||||
@@ -98,36 +80,6 @@ type Auth struct {
|
||||
CredentialsByUserAgent map[string]string `ocisConfig:""`
|
||||
}
|
||||
|
||||
// Config combines all available configuration parts.
|
||||
type Config struct {
|
||||
*shared.Commons
|
||||
|
||||
Service Service `ocisConfig:"service"`
|
||||
|
||||
Tracing Tracing `ocisConfig:"tracing"`
|
||||
Log Log `ocisConfig:"log"`
|
||||
Debug Debug `ocisConfig:"debug"`
|
||||
|
||||
HTTP HTTP `ocisConfig:"http"`
|
||||
|
||||
Policies []Policy `ocisConfig:"policies"`
|
||||
OIDC OIDC `ocisConfig:"oidc"`
|
||||
TokenManager TokenManager `ocisConfig:"token_manager"`
|
||||
PolicySelector *PolicySelector `ocisConfig:"policy_selector"`
|
||||
Reva Reva `ocisConfig:"reva"`
|
||||
PreSignedURL PreSignedURL `ocisConfig:"pre_signed_url"`
|
||||
AccountBackend string `ocisConfig:"account_backend" env:"PROXY_ACCOUNT_BACKEND_TYPE"`
|
||||
UserOIDCClaim string `ocisConfig:"user_oidc_claim" env:"PROXY_USER_OIDC_CLAIM"`
|
||||
UserCS3Claim string `ocisConfig:"user_cs3_claim" env:"PROXY_USER_CS3_CLAIM"`
|
||||
MachineAuthAPIKey string `ocisConfig:"machine_auth_api_key" env:"OCIS_MACHINE_AUTH_API_KEY;PROXY_MACHINE_AUTH_API_KEY"`
|
||||
AutoprovisionAccounts bool `ocisConfig:"auto_provision_accounts" env:"PROXY_AUTOPROVISION_ACCOUNTS"`
|
||||
EnableBasicAuth bool `ocisConfig:"enable_basic_auth" env:"PROXY_ENABLE_BASIC_AUTH"`
|
||||
InsecureBackends bool `ocisConfig:"insecure_backends" env:"PROXY_INSECURE_BACKENDS"`
|
||||
|
||||
Context context.Context
|
||||
Supervised bool
|
||||
}
|
||||
|
||||
// OIDC is the config for the OpenID-Connect middleware. If set the proxy will try to authenticate every request
|
||||
// with the configured oidc-provider
|
||||
type OIDC struct {
|
||||
@@ -194,217 +146,3 @@ type RegexRuleConf struct {
|
||||
Match string `ocisConfig:"match"`
|
||||
Policy string `ocisConfig:"policy"`
|
||||
}
|
||||
|
||||
// DefaultConfig provides with a working local configuration for a proxy service.
|
||||
func DefaultConfig() *Config {
|
||||
return &Config{
|
||||
Debug: Debug{
|
||||
Addr: "0.0.0.0:9205",
|
||||
Token: "",
|
||||
},
|
||||
HTTP: HTTP{
|
||||
Addr: "0.0.0.0:9200",
|
||||
Root: "/",
|
||||
Namespace: "com.owncloud.web",
|
||||
TLSCert: path.Join(defaults.BaseDataPath(), "proxy", "server.crt"),
|
||||
TLSKey: path.Join(defaults.BaseDataPath(), "proxy", "server.key"),
|
||||
TLS: true,
|
||||
},
|
||||
Service: Service{
|
||||
Name: "proxy",
|
||||
},
|
||||
Tracing: Tracing{
|
||||
Type: "jaeger",
|
||||
Endpoint: "",
|
||||
Collector: "",
|
||||
Service: "proxy",
|
||||
},
|
||||
OIDC: OIDC{
|
||||
Issuer: "https://localhost:9200",
|
||||
Insecure: true,
|
||||
//Insecure: true,
|
||||
UserinfoCache: UserinfoCache{
|
||||
Size: 1024,
|
||||
TTL: 10,
|
||||
},
|
||||
},
|
||||
TokenManager: TokenManager{
|
||||
JWTSecret: "Pive-Fumkiu4",
|
||||
},
|
||||
PolicySelector: nil,
|
||||
Reva: Reva{
|
||||
Address: "127.0.0.1:9142",
|
||||
},
|
||||
PreSignedURL: PreSignedURL{
|
||||
AllowedHTTPMethods: []string{"GET"},
|
||||
Enabled: true,
|
||||
},
|
||||
AccountBackend: "accounts",
|
||||
UserOIDCClaim: "email",
|
||||
UserCS3Claim: "mail",
|
||||
MachineAuthAPIKey: "change-me-please",
|
||||
AutoprovisionAccounts: false,
|
||||
EnableBasicAuth: false,
|
||||
InsecureBackends: false,
|
||||
// TODO: enable
|
||||
//Policies: defaultPolicies(),
|
||||
}
|
||||
}
|
||||
|
||||
func DefaultPolicies() []Policy {
|
||||
return []Policy{
|
||||
{
|
||||
Name: "ocis",
|
||||
Routes: []Route{
|
||||
{
|
||||
Endpoint: "/",
|
||||
Backend: "http://localhost:9100",
|
||||
},
|
||||
{
|
||||
Endpoint: "/.well-known/",
|
||||
Backend: "http://localhost:9130",
|
||||
},
|
||||
{
|
||||
Endpoint: "/konnect/",
|
||||
Backend: "http://localhost:9130",
|
||||
},
|
||||
{
|
||||
Endpoint: "/signin/",
|
||||
Backend: "http://localhost:9130",
|
||||
},
|
||||
{
|
||||
Endpoint: "/archiver",
|
||||
Backend: "http://localhost:9140",
|
||||
},
|
||||
{
|
||||
Type: RegexRoute,
|
||||
Endpoint: "/ocs/v[12].php/cloud/(users?|groups)", // we have `user`, `users` and `groups` in ocis-ocs
|
||||
Backend: "http://localhost:9110",
|
||||
},
|
||||
{
|
||||
Endpoint: "/ocs/",
|
||||
Backend: "http://localhost:9140",
|
||||
},
|
||||
{
|
||||
Type: QueryRoute,
|
||||
Endpoint: "/remote.php/?preview=1",
|
||||
Backend: "http://localhost:9115",
|
||||
},
|
||||
{
|
||||
Endpoint: "/remote.php/",
|
||||
Backend: "http://localhost:9140",
|
||||
},
|
||||
{
|
||||
Endpoint: "/dav/",
|
||||
Backend: "http://localhost:9140",
|
||||
},
|
||||
{
|
||||
Endpoint: "/webdav/",
|
||||
Backend: "http://localhost:9140",
|
||||
},
|
||||
{
|
||||
Endpoint: "/status.php",
|
||||
Backend: "http://localhost:9140",
|
||||
},
|
||||
{
|
||||
Endpoint: "/index.php/",
|
||||
Backend: "http://localhost:9140",
|
||||
},
|
||||
{
|
||||
Endpoint: "/data",
|
||||
Backend: "http://localhost:9140",
|
||||
},
|
||||
{
|
||||
Endpoint: "/app/",
|
||||
Backend: "http://localhost:9140",
|
||||
},
|
||||
{
|
||||
Endpoint: "/graph/",
|
||||
Backend: "http://localhost:9120",
|
||||
},
|
||||
{
|
||||
Endpoint: "/graph-explorer",
|
||||
Backend: "http://localhost:9135",
|
||||
},
|
||||
// if we were using the go micro api gateway we could look up the endpoint in the registry dynamically
|
||||
{
|
||||
Endpoint: "/api/v0/accounts",
|
||||
Backend: "http://localhost:9181",
|
||||
},
|
||||
// TODO the lookup needs a better mechanism
|
||||
{
|
||||
Endpoint: "/accounts.js",
|
||||
Backend: "http://localhost:9181",
|
||||
},
|
||||
{
|
||||
Endpoint: "/api/v0/settings",
|
||||
Backend: "http://localhost:9190",
|
||||
},
|
||||
{
|
||||
Endpoint: "/settings.js",
|
||||
Backend: "http://localhost:9190",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "oc10",
|
||||
Routes: []Route{
|
||||
{
|
||||
Endpoint: "/",
|
||||
Backend: "http://localhost:9100",
|
||||
},
|
||||
{
|
||||
Endpoint: "/.well-known/",
|
||||
Backend: "http://localhost:9130",
|
||||
},
|
||||
{
|
||||
Endpoint: "/konnect/",
|
||||
Backend: "http://localhost:9130",
|
||||
},
|
||||
{
|
||||
Endpoint: "/signin/",
|
||||
Backend: "http://localhost:9130",
|
||||
},
|
||||
{
|
||||
Endpoint: "/archiver",
|
||||
Backend: "http://localhost:9140",
|
||||
},
|
||||
{
|
||||
Endpoint: "/ocs/",
|
||||
Backend: "https://demo.owncloud.com",
|
||||
ApacheVHost: true,
|
||||
},
|
||||
{
|
||||
Endpoint: "/remote.php/",
|
||||
Backend: "https://demo.owncloud.com",
|
||||
ApacheVHost: true,
|
||||
},
|
||||
{
|
||||
Endpoint: "/dav/",
|
||||
Backend: "https://demo.owncloud.com",
|
||||
ApacheVHost: true,
|
||||
},
|
||||
{
|
||||
Endpoint: "/webdav/",
|
||||
Backend: "https://demo.owncloud.com",
|
||||
ApacheVHost: true,
|
||||
},
|
||||
{
|
||||
Endpoint: "/status.php",
|
||||
Backend: "https://demo.owncloud.com",
|
||||
ApacheVHost: true,
|
||||
},
|
||||
{
|
||||
Endpoint: "/index.php/",
|
||||
Backend: "https://demo.owncloud.com",
|
||||
ApacheVHost: true,
|
||||
},
|
||||
{
|
||||
Endpoint: "/data",
|
||||
Backend: "https://demo.owncloud.com",
|
||||
ApacheVHost: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
9
proxy/pkg/config/debug.go
Normal file
9
proxy/pkg/config/debug.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package config
|
||||
|
||||
// Debug defines the available debug configuration.
|
||||
type Debug struct {
|
||||
Addr string `ocisConfig:"addr" env:"PROXY_DEBUG_ADDR"`
|
||||
Token string `ocisConfig:"token" env:"PROXY_DEBUG_TOKEN"`
|
||||
Pprof bool `ocisConfig:"pprof" env:"PROXY_DEBUG_PPROF"`
|
||||
Zpages bool `ocisConfig:"zpages" env:"PROXY_DEBUG_ZPAGES"`
|
||||
}
|
||||
220
proxy/pkg/config/defaultconfig.go
Normal file
220
proxy/pkg/config/defaultconfig.go
Normal file
@@ -0,0 +1,220 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"path"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/config/defaults"
|
||||
)
|
||||
|
||||
func DefaultConfig() *Config {
|
||||
return &Config{
|
||||
Debug: Debug{
|
||||
Addr: "0.0.0.0:9205",
|
||||
Token: "",
|
||||
},
|
||||
HTTP: HTTP{
|
||||
Addr: "0.0.0.0:9200",
|
||||
Root: "/",
|
||||
Namespace: "com.owncloud.web",
|
||||
TLSCert: path.Join(defaults.BaseDataPath(), "proxy", "server.crt"),
|
||||
TLSKey: path.Join(defaults.BaseDataPath(), "proxy", "server.key"),
|
||||
TLS: true,
|
||||
},
|
||||
Service: Service{
|
||||
Name: "proxy",
|
||||
},
|
||||
Tracing: Tracing{
|
||||
Type: "jaeger",
|
||||
Endpoint: "",
|
||||
Collector: "",
|
||||
Service: "proxy",
|
||||
},
|
||||
OIDC: OIDC{
|
||||
Issuer: "https://localhost:9200",
|
||||
Insecure: true,
|
||||
//Insecure: true,
|
||||
UserinfoCache: UserinfoCache{
|
||||
Size: 1024,
|
||||
TTL: 10,
|
||||
},
|
||||
},
|
||||
TokenManager: TokenManager{
|
||||
JWTSecret: "Pive-Fumkiu4",
|
||||
},
|
||||
PolicySelector: nil,
|
||||
Reva: Reva{
|
||||
Address: "127.0.0.1:9142",
|
||||
},
|
||||
PreSignedURL: PreSignedURL{
|
||||
AllowedHTTPMethods: []string{"GET"},
|
||||
Enabled: true,
|
||||
},
|
||||
AccountBackend: "accounts",
|
||||
UserOIDCClaim: "email",
|
||||
UserCS3Claim: "mail",
|
||||
MachineAuthAPIKey: "change-me-please",
|
||||
AutoprovisionAccounts: false,
|
||||
EnableBasicAuth: false,
|
||||
InsecureBackends: false,
|
||||
// TODO: enable
|
||||
//Policies: defaultPolicies(),
|
||||
}
|
||||
}
|
||||
|
||||
func DefaultPolicies() []Policy {
|
||||
return []Policy{
|
||||
{
|
||||
Name: "ocis",
|
||||
Routes: []Route{
|
||||
{
|
||||
Endpoint: "/",
|
||||
Backend: "http://localhost:9100",
|
||||
},
|
||||
{
|
||||
Endpoint: "/.well-known/",
|
||||
Backend: "http://localhost:9130",
|
||||
},
|
||||
{
|
||||
Endpoint: "/konnect/",
|
||||
Backend: "http://localhost:9130",
|
||||
},
|
||||
{
|
||||
Endpoint: "/signin/",
|
||||
Backend: "http://localhost:9130",
|
||||
},
|
||||
{
|
||||
Endpoint: "/archiver",
|
||||
Backend: "http://localhost:9140",
|
||||
},
|
||||
{
|
||||
Type: RegexRoute,
|
||||
Endpoint: "/ocs/v[12].php/cloud/(users?|groups)", // we have `user`, `users` and `groups` in ocis-ocs
|
||||
Backend: "http://localhost:9110",
|
||||
},
|
||||
{
|
||||
Endpoint: "/ocs/",
|
||||
Backend: "http://localhost:9140",
|
||||
},
|
||||
{
|
||||
Type: QueryRoute,
|
||||
Endpoint: "/remote.php/?preview=1",
|
||||
Backend: "http://localhost:9115",
|
||||
},
|
||||
{
|
||||
Endpoint: "/remote.php/",
|
||||
Backend: "http://localhost:9140",
|
||||
},
|
||||
{
|
||||
Endpoint: "/dav/",
|
||||
Backend: "http://localhost:9140",
|
||||
},
|
||||
{
|
||||
Endpoint: "/webdav/",
|
||||
Backend: "http://localhost:9140",
|
||||
},
|
||||
{
|
||||
Endpoint: "/status.php",
|
||||
Backend: "http://localhost:9140",
|
||||
},
|
||||
{
|
||||
Endpoint: "/index.php/",
|
||||
Backend: "http://localhost:9140",
|
||||
},
|
||||
{
|
||||
Endpoint: "/data",
|
||||
Backend: "http://localhost:9140",
|
||||
},
|
||||
{
|
||||
Endpoint: "/app/",
|
||||
Backend: "http://localhost:9140",
|
||||
},
|
||||
{
|
||||
Endpoint: "/graph/",
|
||||
Backend: "http://localhost:9120",
|
||||
},
|
||||
{
|
||||
Endpoint: "/graph-explorer",
|
||||
Backend: "http://localhost:9135",
|
||||
},
|
||||
// if we were using the go micro api gateway we could look up the endpoint in the registry dynamically
|
||||
{
|
||||
Endpoint: "/api/v0/accounts",
|
||||
Backend: "http://localhost:9181",
|
||||
},
|
||||
// TODO the lookup needs a better mechanism
|
||||
{
|
||||
Endpoint: "/accounts.js",
|
||||
Backend: "http://localhost:9181",
|
||||
},
|
||||
{
|
||||
Endpoint: "/api/v0/settings",
|
||||
Backend: "http://localhost:9190",
|
||||
},
|
||||
{
|
||||
Endpoint: "/settings.js",
|
||||
Backend: "http://localhost:9190",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "oc10",
|
||||
Routes: []Route{
|
||||
{
|
||||
Endpoint: "/",
|
||||
Backend: "http://localhost:9100",
|
||||
},
|
||||
{
|
||||
Endpoint: "/.well-known/",
|
||||
Backend: "http://localhost:9130",
|
||||
},
|
||||
{
|
||||
Endpoint: "/konnect/",
|
||||
Backend: "http://localhost:9130",
|
||||
},
|
||||
{
|
||||
Endpoint: "/signin/",
|
||||
Backend: "http://localhost:9130",
|
||||
},
|
||||
{
|
||||
Endpoint: "/archiver",
|
||||
Backend: "http://localhost:9140",
|
||||
},
|
||||
{
|
||||
Endpoint: "/ocs/",
|
||||
Backend: "https://demo.owncloud.com",
|
||||
ApacheVHost: true,
|
||||
},
|
||||
{
|
||||
Endpoint: "/remote.php/",
|
||||
Backend: "https://demo.owncloud.com",
|
||||
ApacheVHost: true,
|
||||
},
|
||||
{
|
||||
Endpoint: "/dav/",
|
||||
Backend: "https://demo.owncloud.com",
|
||||
ApacheVHost: true,
|
||||
},
|
||||
{
|
||||
Endpoint: "/webdav/",
|
||||
Backend: "https://demo.owncloud.com",
|
||||
ApacheVHost: true,
|
||||
},
|
||||
{
|
||||
Endpoint: "/status.php",
|
||||
Backend: "https://demo.owncloud.com",
|
||||
ApacheVHost: true,
|
||||
},
|
||||
{
|
||||
Endpoint: "/index.php/",
|
||||
Backend: "https://demo.owncloud.com",
|
||||
ApacheVHost: true,
|
||||
},
|
||||
{
|
||||
Endpoint: "/data",
|
||||
Backend: "https://demo.owncloud.com",
|
||||
ApacheVHost: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
11
proxy/pkg/config/http.go
Normal file
11
proxy/pkg/config/http.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package config
|
||||
|
||||
// HTTP defines the available http configuration.
|
||||
type HTTP struct {
|
||||
Addr string `ocisConfig:"addr" env:"PROXY_HTTP_ADDR"`
|
||||
Root string `ocisConfig:"root" env:"PROXY_HTTP_ROOT"`
|
||||
Namespace string
|
||||
TLSCert string `ocisConfig:"tls_cert" env:"PROXY_TRANSPORT_TLS_CERT"`
|
||||
TLSKey string `ocisConfig:"tls_key" env:"PROXY_TRANSPORT_TLS_KEY"`
|
||||
TLS bool `ocisConfig:"tls" env:"PROXY_TLS"`
|
||||
}
|
||||
9
proxy/pkg/config/log.go
Normal file
9
proxy/pkg/config/log.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package config
|
||||
|
||||
// Log defines the available log configuration.
|
||||
type Log struct {
|
||||
Level string `mapstructure:"level" env:"OCIS_LOG_LEVEL;PROXY_LOG_LEVEL"`
|
||||
Pretty bool `mapstructure:"pretty" env:"OCIS_LOG_PRETTY;PROXY_LOG_PRETTY"`
|
||||
Color bool `mapstructure:"color" env:"OCIS_LOG_COLOR;PROXY_LOG_COLOR"`
|
||||
File string `mapstructure:"file" env:"OCIS_LOG_FILE;PROXY_LOG_FILE"`
|
||||
}
|
||||
7
proxy/pkg/config/service.go
Normal file
7
proxy/pkg/config/service.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package config
|
||||
|
||||
// Service defines the available service configuration.
|
||||
type Service struct {
|
||||
Name string
|
||||
Version string
|
||||
}
|
||||
10
proxy/pkg/config/tracing.go
Normal file
10
proxy/pkg/config/tracing.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package config
|
||||
|
||||
// Tracing defines the available tracing configuration.
|
||||
type Tracing struct {
|
||||
Enabled bool `ocisConfig:"enabled" env:"OCIS_TRACING_ENABLED;PROXY_TRACING_ENABLED"`
|
||||
Type string `ocisConfig:"type" env:"OCIS_TRACING_TYPE;PROXY_TRACING_TYPE"`
|
||||
Endpoint string `ocisConfig:"endpoint" env:"OCIS_TRACING_ENDPOINT;PROXY_TRACING_ENDPOINT"`
|
||||
Collector string `ocisConfig:"collector" env:"OCIS_TRACING_COLLECTOR;PROXY_TRACING_COLLECTOR"`
|
||||
Service string `ocisConfig:"service" env:"PROXY_TRACING_SERVICE"` //TODO: should this be an ID? or the same as Service.Name?
|
||||
}
|
||||
@@ -2,82 +2,11 @@ package config
|
||||
|
||||
import (
|
||||
"context"
|
||||
"path"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/shared"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/config/defaults"
|
||||
)
|
||||
|
||||
// Debug defines the available debug configuration.
|
||||
type Debug struct {
|
||||
Addr string `ocisConfig:"addr" env:"SETTINGS_DEBUG_ADDR"`
|
||||
Token string `ocisConfig:"token" env:"SETTINGS_DEBUG_TOKEN"`
|
||||
Pprof bool `ocisConfig:"pprof" env:"SETTINGS_DEBUG_PPROF"`
|
||||
Zpages bool `ocisConfig:"zpages" env:"SETTINGS_DEBUG_ZPAGES"`
|
||||
}
|
||||
|
||||
// CORS defines the available cors configuration.
|
||||
type CORS struct {
|
||||
AllowedOrigins []string `ocisConfig:"allowed_origins"`
|
||||
AllowedMethods []string `ocisConfig:"allowed_methods"`
|
||||
AllowedHeaders []string `ocisConfig:"allowed_headers"`
|
||||
AllowCredentials bool `ocisConfig:"allow_credentials"`
|
||||
}
|
||||
|
||||
// HTTP defines the available http configuration.
|
||||
type HTTP struct {
|
||||
Addr string `ocisConfig:"addr" env:"SETTINGS_HTTP_ADDR"`
|
||||
Namespace string
|
||||
Root string `ocisConfig:"root" env:"SETTINGS_HTTP_ROOT"`
|
||||
CacheTTL int `ocisConfig:"cache_ttl" env:"SETTINGS_CACHE_TTL"`
|
||||
CORS CORS `ocisConfig:"cors"`
|
||||
}
|
||||
|
||||
// GRPC defines the available grpc configuration.
|
||||
type GRPC struct {
|
||||
Addr string `ocisConfig:"addr" env:"SETTINGS_GRPC_ADDR"`
|
||||
Namespace string
|
||||
}
|
||||
|
||||
// Service defines the available service configuration.
|
||||
type Service struct {
|
||||
Name string
|
||||
Version string
|
||||
}
|
||||
|
||||
// Tracing defines the available tracing configuration.
|
||||
type Tracing struct {
|
||||
Enabled bool `ocisConfig:"enabled" env:"OCIS_TRACING_ENABLED;SETTINGS_TRACING_ENABLED"`
|
||||
Type string `ocisConfig:"type" env:"OCIS_TRACING_TYPE;SETTINGS_TRACING_TYPE"`
|
||||
Endpoint string `ocisConfig:"endpoint" env:"OCIS_TRACING_ENDPOINT;SETTINGS_TRACING_ENDPOINT"`
|
||||
Collector string `ocisConfig:"collector" env:"OCIS_TRACING_COLLECTOR;SETTINGS_TRACING_COLLECTOR"`
|
||||
Service string `ocisConfig:"service" env:"SETTINGS_TRACING_SERVICE"` //TODO: should this be an ID? or the same as Service.Name?
|
||||
}
|
||||
|
||||
// Log defines the available log configuration.
|
||||
type Log struct {
|
||||
Level string `mapstructure:"level" env:"OCIS_LOG_LEVEL;SETTINGS_LOG_LEVEL"`
|
||||
Pretty bool `mapstructure:"pretty" env:"OCIS_LOG_PRETTY;SETTINGS_LOG_PRETTY"`
|
||||
Color bool `mapstructure:"color" env:"OCIS_LOG_COLOR;SETTINGS_LOG_COLOR"`
|
||||
File string `mapstructure:"file" env:"OCIS_LOG_FILE;SETTINGS_LOG_FILE"`
|
||||
}
|
||||
|
||||
// Asset defines the available asset configuration.
|
||||
type Asset struct {
|
||||
Path string `ocisConfig:"path" env:"SETTINGS_ASSET_PATH"`
|
||||
}
|
||||
|
||||
// TokenManager is the config for using the reva token manager
|
||||
type TokenManager struct {
|
||||
JWTSecret string `ocisConfig:"jwt_secret" env:"OCIS_JWT_SECRET;SETTINGS_JWT_SECRET"`
|
||||
}
|
||||
|
||||
// Config combines all available configuration parts.
|
||||
type Config struct {
|
||||
*shared.Commons
|
||||
|
||||
Service Service `ocisConfig:"service"`
|
||||
Service Service
|
||||
|
||||
Tracing Tracing `ocisConfig:"tracing"`
|
||||
Log Log `ocisConfig:"log"`
|
||||
@@ -94,47 +23,8 @@ type Config struct {
|
||||
Supervised bool
|
||||
}
|
||||
|
||||
// DefaultConfig provides sane bootstrapping defaults.
|
||||
func DefaultConfig() *Config {
|
||||
return &Config{
|
||||
Service: Service{
|
||||
Name: "settings",
|
||||
},
|
||||
Debug: Debug{
|
||||
Addr: "127.0.0.1:9194",
|
||||
Token: "",
|
||||
Pprof: false,
|
||||
Zpages: false,
|
||||
},
|
||||
HTTP: HTTP{
|
||||
Addr: "127.0.0.1:9190",
|
||||
Namespace: "com.owncloud.web",
|
||||
Root: "/",
|
||||
CacheTTL: 604800, // 7 days
|
||||
CORS: CORS{
|
||||
AllowedOrigins: []string{"*"},
|
||||
AllowedMethods: []string{"GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"},
|
||||
AllowedHeaders: []string{"Authorization", "Origin", "Content-Type", "Accept", "X-Requested-With"},
|
||||
AllowCredentials: true,
|
||||
},
|
||||
},
|
||||
GRPC: GRPC{
|
||||
Addr: "127.0.0.1:9191",
|
||||
Namespace: "com.owncloud.api",
|
||||
},
|
||||
Tracing: Tracing{
|
||||
Enabled: false,
|
||||
Type: "jaeger",
|
||||
Endpoint: "",
|
||||
Collector: "",
|
||||
Service: "settings",
|
||||
},
|
||||
DataPath: path.Join(defaults.BaseDataPath(), "settings"),
|
||||
Asset: Asset{
|
||||
Path: "",
|
||||
},
|
||||
TokenManager: TokenManager{
|
||||
JWTSecret: "Pive-Fumkiu4",
|
||||
},
|
||||
}
|
||||
// Asset defines the available asset configuration.
|
||||
type Asset struct {
|
||||
Path string `ocisConfig:"path" env:"SETTINGS_ASSET_PATH"`
|
||||
}
|
||||
|
||||
|
||||
9
settings/pkg/config/debug.go
Normal file
9
settings/pkg/config/debug.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package config
|
||||
|
||||
// Debug defines the available debug configuration.
|
||||
type Debug struct {
|
||||
Addr string `ocisConfig:"addr" env:"SETTINGS_DEBUG_ADDR"`
|
||||
Token string `ocisConfig:"token" env:"SETTINGS_DEBUG_TOKEN"`
|
||||
Pprof bool `ocisConfig:"pprof" env:"SETTINGS_DEBUG_PPROF"`
|
||||
Zpages bool `ocisConfig:"zpages" env:"SETTINGS_DEBUG_ZPAGES"`
|
||||
}
|
||||
51
settings/pkg/config/defaultconfig.go
Normal file
51
settings/pkg/config/defaultconfig.go
Normal file
@@ -0,0 +1,51 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"path"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/config/defaults"
|
||||
)
|
||||
|
||||
func DefaultConfig() *Config {
|
||||
return &Config{
|
||||
Service: Service{
|
||||
Name: "settings",
|
||||
},
|
||||
Debug: Debug{
|
||||
Addr: "127.0.0.1:9194",
|
||||
Token: "",
|
||||
Pprof: false,
|
||||
Zpages: false,
|
||||
},
|
||||
HTTP: HTTP{
|
||||
Addr: "127.0.0.1:9190",
|
||||
Namespace: "com.owncloud.web",
|
||||
Root: "/",
|
||||
CacheTTL: 604800, // 7 days
|
||||
CORS: CORS{
|
||||
AllowedOrigins: []string{"*"},
|
||||
AllowedMethods: []string{"GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"},
|
||||
AllowedHeaders: []string{"Authorization", "Origin", "Content-Type", "Accept", "X-Requested-With"},
|
||||
AllowCredentials: true,
|
||||
},
|
||||
},
|
||||
GRPC: GRPC{
|
||||
Addr: "127.0.0.1:9191",
|
||||
Namespace: "com.owncloud.api",
|
||||
},
|
||||
Tracing: Tracing{
|
||||
Enabled: false,
|
||||
Type: "jaeger",
|
||||
Endpoint: "",
|
||||
Collector: "",
|
||||
Service: "settings",
|
||||
},
|
||||
DataPath: path.Join(defaults.BaseDataPath(), "settings"),
|
||||
Asset: Asset{
|
||||
Path: "",
|
||||
},
|
||||
TokenManager: TokenManager{
|
||||
JWTSecret: "Pive-Fumkiu4",
|
||||
},
|
||||
}
|
||||
}
|
||||
7
settings/pkg/config/grpc.go
Normal file
7
settings/pkg/config/grpc.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package config
|
||||
|
||||
// GRPC defines the available grpc configuration.
|
||||
type GRPC struct {
|
||||
Addr string `ocisConfig:"addr" env:"SETTINGS_GRPC_ADDR"`
|
||||
Namespace string
|
||||
}
|
||||
18
settings/pkg/config/http.go
Normal file
18
settings/pkg/config/http.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package config
|
||||
|
||||
// HTTP defines the available http configuration.
|
||||
type HTTP struct {
|
||||
Addr string `ocisConfig:"addr" env:"SETTINGS_HTTP_ADDR"`
|
||||
Namespace string
|
||||
Root string `ocisConfig:"root" env:"SETTINGS_HTTP_ROOT"`
|
||||
CacheTTL int `ocisConfig:"cache_ttl" env:"SETTINGS_CACHE_TTL"`
|
||||
CORS CORS `ocisConfig:"cors"`
|
||||
}
|
||||
|
||||
// CORS defines the available cors configuration.
|
||||
type CORS struct {
|
||||
AllowedOrigins []string `ocisConfig:"allowed_origins"`
|
||||
AllowedMethods []string `ocisConfig:"allowed_methods"`
|
||||
AllowedHeaders []string `ocisConfig:"allowed_headers"`
|
||||
AllowCredentials bool `ocisConfig:"allowed_credentials"`
|
||||
}
|
||||
9
settings/pkg/config/log.go
Normal file
9
settings/pkg/config/log.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package config
|
||||
|
||||
// Log defines the available log configuration.
|
||||
type Log struct {
|
||||
Level string `mapstructure:"level" env:"OCIS_LOG_LEVEL;SETTINGS_LOG_LEVEL"`
|
||||
Pretty bool `mapstructure:"pretty" env:"OCIS_LOG_PRETTY;SETTINGS_LOG_PRETTY"`
|
||||
Color bool `mapstructure:"color" env:"OCIS_LOG_COLOR;SETTINGS_LOG_COLOR"`
|
||||
File string `mapstructure:"file" env:"OCIS_LOG_FILE;SETTINGS_LOG_FILE"`
|
||||
}
|
||||
6
settings/pkg/config/reva.go
Normal file
6
settings/pkg/config/reva.go
Normal file
@@ -0,0 +1,6 @@
|
||||
package config
|
||||
|
||||
// TokenManager is the config for using the reva token manager
|
||||
type TokenManager struct {
|
||||
JWTSecret string `ocisConfig:"jwt_secret" env:"OCIS_JWT_SECRET;SETTINGS_JWT_SECRET"`
|
||||
}
|
||||
7
settings/pkg/config/service.go
Normal file
7
settings/pkg/config/service.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package config
|
||||
|
||||
// Service defines the available service configuration.
|
||||
type Service struct {
|
||||
Name string
|
||||
Version string
|
||||
}
|
||||
10
settings/pkg/config/tracing.go
Normal file
10
settings/pkg/config/tracing.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package config
|
||||
|
||||
// Tracing defines the available tracing configuration.
|
||||
type Tracing struct {
|
||||
Enabled bool `ocisConfig:"enabled" env:"OCIS_TRACING_ENABLED;SETTINGS_TRACING_ENABLED"`
|
||||
Type string `ocisConfig:"type" env:"OCIS_TRACING_TYPE;SETTINGS_TRACING_TYPE"`
|
||||
Endpoint string `ocisConfig:"endpoint" env:"OCIS_TRACING_ENDPOINT;SETTINGS_TRACING_ENDPOINT"`
|
||||
Collector string `ocisConfig:"collector" env:"OCIS_TRACING_COLLECTOR;SETTINGS_TRACING_COLLECTOR"`
|
||||
Service string `ocisConfig:"service" env:"SETTINGS_TRACING_SERVICE"` //TODO: should this be an ID? or the same as Service.Name?
|
||||
}
|
||||
@@ -129,7 +129,7 @@ type AppProviderSutureService struct {
|
||||
|
||||
// NewAppProvider creates a new store.AppProviderSutureService
|
||||
func NewAppProvider(cfg *ociscfg.Config) suture.Service {
|
||||
cfg.Storage.Commons = cfg.Commons
|
||||
////cfg.Storage.Commons = cfg.Commons
|
||||
return AppProviderSutureService{
|
||||
cfg: cfg.Storage,
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ type AuthBasicSutureService struct {
|
||||
|
||||
// NewAuthBasicSutureService creates a new store.AuthBasicSutureService
|
||||
func NewAuthBasic(cfg *ociscfg.Config) suture.Service {
|
||||
cfg.Storage.Commons = cfg.Commons
|
||||
//cfg.Storage.Commons = cfg.Commons
|
||||
return AuthBasicSutureService{
|
||||
cfg: cfg.Storage,
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ type AuthBearerSutureService struct {
|
||||
|
||||
// NewAuthBearerSutureService creates a new gateway.AuthBearerSutureService
|
||||
func NewAuthBearer(cfg *ociscfg.Config) suture.Service {
|
||||
cfg.Storage.Commons = cfg.Commons
|
||||
//cfg.Storage.Commons = cfg.Commons
|
||||
return AuthBearerSutureService{
|
||||
cfg: cfg.Storage,
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ type AuthMachineSutureService struct {
|
||||
|
||||
// NewAuthMachineSutureService creates a new gateway.AuthMachineSutureService
|
||||
func NewAuthMachine(cfg *ociscfg.Config) suture.Service {
|
||||
cfg.Storage.Commons = cfg.Commons
|
||||
//cfg.Storage.Commons = cfg.Commons
|
||||
return AuthMachineSutureService{
|
||||
cfg: cfg.Storage,
|
||||
}
|
||||
|
||||
@@ -339,7 +339,7 @@ type FrontendSutureService struct {
|
||||
|
||||
// NewFrontend creates a new frontend.FrontendSutureService
|
||||
func NewFrontend(cfg *ociscfg.Config) suture.Service {
|
||||
cfg.Storage.Commons = cfg.Commons
|
||||
//cfg.Storage.Commons = cfg.Commons
|
||||
return FrontendSutureService{
|
||||
cfg: cfg.Storage,
|
||||
}
|
||||
|
||||
@@ -352,7 +352,7 @@ type GatewaySutureService struct {
|
||||
|
||||
// NewGatewaySutureService creates a new gateway.GatewaySutureService
|
||||
func NewGateway(cfg *ociscfg.Config) suture.Service {
|
||||
cfg.Storage.Commons = cfg.Commons
|
||||
//cfg.Storage.Commons = cfg.Commons
|
||||
return GatewaySutureService{
|
||||
cfg: cfg.Storage,
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ type GroupSutureService struct {
|
||||
|
||||
// NewGroupProviderSutureService creates a new storage.GroupProvider
|
||||
func NewGroupProvider(cfg *ociscfg.Config) suture.Service {
|
||||
cfg.Storage.Commons = cfg.Commons
|
||||
//cfg.Storage.Commons = cfg.Commons
|
||||
return GroupSutureService{
|
||||
cfg: cfg.Storage,
|
||||
}
|
||||
|
||||
@@ -188,7 +188,7 @@ type SharingSutureService struct {
|
||||
|
||||
// NewSharingSutureService creates a new store.SharingSutureService
|
||||
func NewSharing(cfg *ociscfg.Config) suture.Service {
|
||||
cfg.Storage.Commons = cfg.Commons
|
||||
//cfg.Storage.Commons = cfg.Commons
|
||||
return SharingSutureService{
|
||||
cfg: cfg.Storage,
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ type StorageHomeSutureService struct {
|
||||
|
||||
// NewStorageHomeSutureService creates a new storage.StorageHomeSutureService
|
||||
func NewStorageHome(cfg *ociscfg.Config) suture.Service {
|
||||
cfg.Storage.Commons = cfg.Commons
|
||||
//cfg.Storage.Commons = cfg.Commons
|
||||
return StorageHomeSutureService{
|
||||
cfg: cfg.Storage,
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ type MetadataSutureService struct {
|
||||
|
||||
// NewSutureService creates a new storagemetadata.SutureService
|
||||
func NewStorageMetadata(cfg *ociscfg.Config) suture.Service {
|
||||
cfg.Storage.Commons = cfg.Commons
|
||||
//cfg.Storage.Commons = cfg.Commons
|
||||
return MetadataSutureService{
|
||||
cfg: cfg.Storage,
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ type StoragePublicLinkSutureService struct {
|
||||
|
||||
// NewStoragePublicLinkSutureService creates a new storage.StoragePublicLinkSutureService
|
||||
func NewStoragePublicLink(cfg *ociscfg.Config) suture.Service {
|
||||
cfg.Storage.Commons = cfg.Commons
|
||||
//cfg.Storage.Commons = cfg.Commons
|
||||
return StoragePublicLinkSutureService{
|
||||
cfg: cfg.Storage,
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ type StorageUsersSutureService struct {
|
||||
|
||||
// NewStorageUsersSutureService creates a new storage.StorageUsersSutureService
|
||||
func NewStorageUsers(cfg *ociscfg.Config) suture.Service {
|
||||
cfg.Storage.Commons = cfg.Commons
|
||||
//cfg.Storage.Commons = cfg.Commons
|
||||
return StorageUsersSutureService{
|
||||
cfg: cfg.Storage,
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ type UserProviderSutureService struct {
|
||||
|
||||
// NewUserProviderSutureService creates a new storage.UserProvider
|
||||
func NewUserProvider(cfg *ociscfg.Config) suture.Service {
|
||||
cfg.Storage.Commons = cfg.Commons
|
||||
//cfg.Storage.Commons = cfg.Commons
|
||||
return UserProviderSutureService{
|
||||
cfg: cfg.Storage,
|
||||
}
|
||||
|
||||
@@ -2,34 +2,21 @@ package config
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"path"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/config/defaults"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/shared"
|
||||
)
|
||||
|
||||
// Service defines the available service configuration.
|
||||
type Service struct {
|
||||
Name string
|
||||
Version string
|
||||
}
|
||||
// Config combines all available configuration parts.
|
||||
type Config struct {
|
||||
Service Service
|
||||
|
||||
// Log defines the available logging configuration.
|
||||
type Log struct {
|
||||
Level string `ocisConfig:"level"`
|
||||
Pretty bool `ocisConfig:"pretty"`
|
||||
Color bool `ocisConfig:"color"`
|
||||
File string `ocisConfig:"file"`
|
||||
}
|
||||
Tracing Tracing `ocisConfig:"tracing"`
|
||||
Log Log `ocisConfig:"log"`
|
||||
Debug Debug `ocisConfig:"debug"`
|
||||
|
||||
// Debug defines the available debug configuration.
|
||||
type Debug struct {
|
||||
Addr string `ocisConfig:"addr"`
|
||||
Token string `ocisConfig:"token"`
|
||||
Pprof bool `ocisConfig:"pprof"`
|
||||
Zpages bool `ocisConfig:"zpages"`
|
||||
Reva Reva `ocisConfig:"reva"`
|
||||
|
||||
Asset Asset `ocisConfig:"asset"`
|
||||
}
|
||||
|
||||
// Gateway defines the available gateway configuration.
|
||||
@@ -496,470 +483,11 @@ type Reva struct {
|
||||
DefaultUploadProtocol string `ocisConfig:"default_upload_protocol"`
|
||||
}
|
||||
|
||||
// Tracing defines the available tracing configuration.
|
||||
type Tracing struct {
|
||||
Enabled bool `ocisConfig:"enabled"`
|
||||
Type string `ocisConfig:"type"`
|
||||
Endpoint string `ocisConfig:"endpoint"`
|
||||
Collector string `ocisConfig:"collector"`
|
||||
Service string `ocisConfig:"service"`
|
||||
}
|
||||
|
||||
// Asset defines the available asset configuration.
|
||||
type Asset struct {
|
||||
Path string `ocisConfig:"path"`
|
||||
}
|
||||
|
||||
// Config combines all available configuration parts.
|
||||
type Config struct {
|
||||
*shared.Commons
|
||||
|
||||
Service Service `ocisConfig:"service"`
|
||||
|
||||
Tracing Tracing `ocisConfig:"tracing"`
|
||||
Log Log `ocisConfig:"log"`
|
||||
Debug Debug `ocisConfig:"debug"`
|
||||
|
||||
Reva Reva `ocisConfig:"reva"`
|
||||
|
||||
Asset Asset `ocisConfig:"asset"`
|
||||
}
|
||||
|
||||
func DefaultConfig() *Config {
|
||||
return &Config{
|
||||
// log is inherited
|
||||
Debug: Debug{
|
||||
Addr: "127.0.0.1:9109",
|
||||
},
|
||||
Reva: Reva{
|
||||
JWTSecret: "Pive-Fumkiu4",
|
||||
SkipUserGroupsInToken: false,
|
||||
TransferSecret: "replace-me-with-a-transfer-secret",
|
||||
TransferExpires: 24 * 60 * 60,
|
||||
OIDC: OIDC{
|
||||
Issuer: "https://localhost:9200",
|
||||
Insecure: false,
|
||||
IDClaim: "preferred_username",
|
||||
},
|
||||
LDAP: LDAP{
|
||||
Hostname: "localhost",
|
||||
Port: 9126,
|
||||
CACert: path.Join(defaults.BaseDataPath(), "ldap", "ldap.crt"),
|
||||
Insecure: false,
|
||||
BaseDN: "dc=ocis,dc=test",
|
||||
LoginFilter: "(&(objectclass=posixAccount)(|(cn={{login}})(mail={{login}})))",
|
||||
UserFilter: "(&(objectclass=posixAccount)(|(ownclouduuid={{.OpaqueId}})(cn={{.OpaqueId}})))",
|
||||
UserAttributeFilter: "(&(objectclass=posixAccount)({{attr}}={{value}}))",
|
||||
UserFindFilter: "(&(objectclass=posixAccount)(|(cn={{query}}*)(displayname={{query}}*)(mail={{query}}*)))",
|
||||
UserGroupFilter: "(&(objectclass=posixGroup)(ownclouduuid={{.OpaqueId}}*))",
|
||||
GroupFilter: "(&(objectclass=posixGroup)(|(ownclouduuid={{.OpaqueId}})(cn={{.OpaqueId}})))",
|
||||
GroupAttributeFilter: "(&(objectclass=posixGroup)({{attr}}={{value}}))",
|
||||
GroupFindFilter: "(&(objectclass=posixGroup)(|(cn={{query}}*)(displayname={{query}}*)(mail={{query}}*)))",
|
||||
GroupMemberFilter: "(&(objectclass=posixAccount)(ownclouduuid={{.OpaqueId}}*))",
|
||||
BindDN: "cn=reva,ou=sysusers,dc=ocis,dc=test",
|
||||
BindPassword: "reva",
|
||||
IDP: "https://localhost:9200",
|
||||
UserSchema: LDAPUserSchema{
|
||||
UID: "ownclouduuid",
|
||||
Mail: "mail",
|
||||
DisplayName: "displayname",
|
||||
CN: "cn",
|
||||
UIDNumber: "uidnumber",
|
||||
GIDNumber: "gidnumber",
|
||||
},
|
||||
GroupSchema: LDAPGroupSchema{
|
||||
GID: "cn",
|
||||
Mail: "mail",
|
||||
DisplayName: "cn",
|
||||
CN: "cn",
|
||||
GIDNumber: "gidnumber",
|
||||
},
|
||||
},
|
||||
UserGroupRest: UserGroupRest{
|
||||
RedisAddress: "localhost:6379",
|
||||
},
|
||||
UserOwnCloudSQL: UserOwnCloudSQL{
|
||||
DBUsername: "owncloud",
|
||||
DBPassword: "secret",
|
||||
DBHost: "mysql",
|
||||
DBPort: 3306,
|
||||
DBName: "owncloud",
|
||||
Idp: "https://localhost:9200",
|
||||
Nobody: 90,
|
||||
JoinUsername: false,
|
||||
JoinOwnCloudUUID: false,
|
||||
EnableMedialSearch: false,
|
||||
},
|
||||
OCDav: OCDav{
|
||||
WebdavNamespace: "/home/",
|
||||
DavFilesNamespace: "/users/",
|
||||
},
|
||||
Archiver: Archiver{
|
||||
MaxNumFiles: 10000,
|
||||
MaxSize: 1073741824,
|
||||
ArchiverURL: "/archiver",
|
||||
},
|
||||
UserStorage: StorageConfig{
|
||||
EOS: DriverEOS{
|
||||
DriverCommon: DriverCommon{
|
||||
Root: "/eos/dockertest/reva",
|
||||
ShareFolder: "/Shares",
|
||||
UserLayout: "{{substr 0 1 .Username}}/{{.Username}}",
|
||||
},
|
||||
ShadowNamespace: "", // Defaults to path.Join(c.Namespace, ".shadow")
|
||||
UploadsNamespace: "", // Defaults to path.Join(c.Namespace, ".uploads")
|
||||
EosBinary: "/usr/bin/eos",
|
||||
XrdcopyBinary: "/usr/bin/xrdcopy",
|
||||
MasterURL: "root://eos-mgm1.eoscluster.cern.ch:1094",
|
||||
SlaveURL: "root://eos-mgm1.eoscluster.cern.ch:1094",
|
||||
CacheDirectory: os.TempDir(),
|
||||
GatewaySVC: "127.0.0.1:9142",
|
||||
},
|
||||
Local: DriverCommon{
|
||||
Root: path.Join(defaults.BaseDataPath(), "storage", "local", "users"),
|
||||
ShareFolder: "/Shares",
|
||||
UserLayout: "{{.Username}}",
|
||||
EnableHome: false,
|
||||
},
|
||||
OwnCloud: DriverOwnCloud{
|
||||
DriverCommon: DriverCommon{
|
||||
Root: path.Join(defaults.BaseDataPath(), "storage", "owncloud"),
|
||||
ShareFolder: "/Shares",
|
||||
UserLayout: "{{.Id.OpaqueId}}",
|
||||
EnableHome: false,
|
||||
},
|
||||
UploadInfoDir: path.Join(defaults.BaseDataPath(), "storage", "uploadinfo"),
|
||||
Redis: ":6379",
|
||||
Scan: true,
|
||||
},
|
||||
OwnCloudSQL: DriverOwnCloudSQL{
|
||||
DriverCommon: DriverCommon{
|
||||
Root: path.Join(defaults.BaseDataPath(), "storage", "owncloud"),
|
||||
ShareFolder: "/Shares",
|
||||
UserLayout: "{{.Username}}",
|
||||
EnableHome: false,
|
||||
},
|
||||
UploadInfoDir: path.Join(defaults.BaseDataPath(), "storage", "uploadinfo"),
|
||||
DBUsername: "owncloud",
|
||||
DBPassword: "owncloud",
|
||||
DBHost: "",
|
||||
DBPort: 3306,
|
||||
DBName: "owncloud",
|
||||
},
|
||||
S3: DriverS3{
|
||||
DriverCommon: DriverCommon{},
|
||||
Region: "default",
|
||||
AccessKey: "",
|
||||
SecretKey: "",
|
||||
Endpoint: "",
|
||||
Bucket: "",
|
||||
},
|
||||
S3NG: DriverS3NG{
|
||||
DriverCommon: DriverCommon{
|
||||
Root: path.Join(defaults.BaseDataPath(), "storage", "users"),
|
||||
ShareFolder: "/Shares",
|
||||
UserLayout: "{{.Id.OpaqueId}}",
|
||||
EnableHome: false,
|
||||
},
|
||||
ServiceUserUUID: "95cb8724-03b2-11eb-a0a6-c33ef8ef53ad",
|
||||
Region: "default",
|
||||
AccessKey: "",
|
||||
SecretKey: "",
|
||||
Endpoint: "",
|
||||
Bucket: "",
|
||||
},
|
||||
OCIS: DriverOCIS{
|
||||
DriverCommon: DriverCommon{
|
||||
Root: path.Join(defaults.BaseDataPath(), "storage", "users"),
|
||||
ShareFolder: "/Shares",
|
||||
UserLayout: "{{.Id.OpaqueId}}",
|
||||
},
|
||||
ServiceUserUUID: "95cb8724-03b2-11eb-a0a6-c33ef8ef53ad",
|
||||
},
|
||||
},
|
||||
MetadataStorage: StorageConfig{
|
||||
EOS: DriverEOS{
|
||||
DriverCommon: DriverCommon{
|
||||
Root: "/eos/dockertest/reva",
|
||||
ShareFolder: "/Shares",
|
||||
UserLayout: "{{substr 0 1 .Username}}/{{.Username}}",
|
||||
EnableHome: false,
|
||||
},
|
||||
ShadowNamespace: "",
|
||||
UploadsNamespace: "",
|
||||
EosBinary: "/usr/bin/eos",
|
||||
XrdcopyBinary: "/usr/bin/xrdcopy",
|
||||
MasterURL: "root://eos-mgm1.eoscluster.cern.ch:1094",
|
||||
GrpcURI: "",
|
||||
SlaveURL: "root://eos-mgm1.eoscluster.cern.ch:1094",
|
||||
CacheDirectory: os.TempDir(),
|
||||
EnableLogging: false,
|
||||
ShowHiddenSysFiles: false,
|
||||
ForceSingleUserMode: false,
|
||||
UseKeytab: false,
|
||||
SecProtocol: "",
|
||||
Keytab: "",
|
||||
SingleUsername: "",
|
||||
GatewaySVC: "127.0.0.1:9142",
|
||||
},
|
||||
Local: DriverCommon{
|
||||
Root: path.Join(defaults.BaseDataPath(), "storage", "local", "metadata"),
|
||||
},
|
||||
OwnCloud: DriverOwnCloud{},
|
||||
OwnCloudSQL: DriverOwnCloudSQL{},
|
||||
S3: DriverS3{
|
||||
DriverCommon: DriverCommon{},
|
||||
Region: "default",
|
||||
},
|
||||
S3NG: DriverS3NG{
|
||||
DriverCommon: DriverCommon{
|
||||
Root: path.Join(defaults.BaseDataPath(), "storage", "metadata"),
|
||||
ShareFolder: "",
|
||||
UserLayout: "{{.Id.OpaqueId}}",
|
||||
EnableHome: false,
|
||||
},
|
||||
ServiceUserUUID: "95cb8724-03b2-11eb-a0a6-c33ef8ef53ad",
|
||||
Region: "default",
|
||||
AccessKey: "",
|
||||
SecretKey: "",
|
||||
Endpoint: "",
|
||||
Bucket: "",
|
||||
},
|
||||
OCIS: DriverOCIS{
|
||||
DriverCommon: DriverCommon{
|
||||
Root: path.Join(defaults.BaseDataPath(), "storage", "metadata"),
|
||||
ShareFolder: "",
|
||||
UserLayout: "{{.Id.OpaqueId}}",
|
||||
EnableHome: false,
|
||||
},
|
||||
ServiceUserUUID: "95cb8724-03b2-11eb-a0a6-c33ef8ef53ad",
|
||||
},
|
||||
},
|
||||
Frontend: FrontendPort{
|
||||
Port: Port{
|
||||
MaxCPUs: "",
|
||||
LogLevel: "",
|
||||
GRPCNetwork: "",
|
||||
GRPCAddr: "",
|
||||
HTTPNetwork: "tcp",
|
||||
HTTPAddr: "127.0.0.1:9140",
|
||||
Protocol: "",
|
||||
Endpoint: "",
|
||||
DebugAddr: "127.0.0.1:9141",
|
||||
Services: []string{"datagateway", "ocdav", "ocs", "appprovider"},
|
||||
Config: nil,
|
||||
Context: nil,
|
||||
Supervised: false,
|
||||
},
|
||||
AppProviderInsecure: false,
|
||||
AppProviderPrefix: "",
|
||||
ArchiverInsecure: false,
|
||||
ArchiverPrefix: "archiver",
|
||||
DatagatewayPrefix: "data",
|
||||
Favorites: false,
|
||||
OCDavInsecure: false,
|
||||
OCDavPrefix: "",
|
||||
OCSPrefix: "ocs",
|
||||
OCSSharePrefix: "/Shares",
|
||||
OCSHomeNamespace: "/home",
|
||||
PublicURL: "https://localhost:9200",
|
||||
OCSCacheWarmupDriver: "",
|
||||
OCSAdditionalInfoAttribute: "{{.Mail}}",
|
||||
OCSResourceInfoCacheTTL: 0,
|
||||
Middleware: Middleware{},
|
||||
},
|
||||
DataGateway: DataGatewayPort{
|
||||
Port: Port{},
|
||||
PublicURL: "",
|
||||
},
|
||||
Gateway: Gateway{
|
||||
Port: Port{
|
||||
Endpoint: "127.0.0.1:9142",
|
||||
DebugAddr: "127.0.0.1:9143",
|
||||
GRPCNetwork: "tcp",
|
||||
GRPCAddr: "127.0.0.1:9142",
|
||||
},
|
||||
CommitShareToStorageGrant: true,
|
||||
CommitShareToStorageRef: true,
|
||||
DisableHomeCreationOnLogin: false,
|
||||
ShareFolder: "Shares",
|
||||
LinkGrants: "",
|
||||
HomeMapping: "",
|
||||
EtagCacheTTL: 0,
|
||||
},
|
||||
StorageRegistry: StorageRegistry{
|
||||
Driver: "static",
|
||||
HomeProvider: "/home",
|
||||
JSON: "",
|
||||
},
|
||||
AppRegistry: AppRegistry{
|
||||
Driver: "static",
|
||||
MimetypesJSON: "",
|
||||
},
|
||||
Users: Users{
|
||||
Port: Port{
|
||||
Endpoint: "localhost:9144",
|
||||
DebugAddr: "127.0.0.1:9145",
|
||||
GRPCNetwork: "tcp",
|
||||
GRPCAddr: "127.0.0.1:9144",
|
||||
Services: []string{"userprovider"},
|
||||
},
|
||||
Driver: "ldap",
|
||||
UserGroupsCacheExpiration: 5,
|
||||
},
|
||||
Groups: Groups{
|
||||
Port: Port{
|
||||
Endpoint: "localhost:9160",
|
||||
DebugAddr: "127.0.0.1:9161",
|
||||
GRPCNetwork: "tcp",
|
||||
GRPCAddr: "127.0.0.1:9160",
|
||||
Services: []string{"groupprovider"},
|
||||
},
|
||||
Driver: "ldap",
|
||||
GroupMembersCacheExpiration: 5,
|
||||
},
|
||||
AuthProvider: Users{
|
||||
Port: Port{},
|
||||
Driver: "ldap",
|
||||
UserGroupsCacheExpiration: 0,
|
||||
},
|
||||
AuthBasic: Port{
|
||||
GRPCNetwork: "tcp",
|
||||
GRPCAddr: "127.0.0.1:9146",
|
||||
DebugAddr: "127.0.0.1:9147",
|
||||
Services: []string{"authprovider"},
|
||||
Endpoint: "localhost:9146",
|
||||
},
|
||||
AuthBearer: Port{
|
||||
GRPCNetwork: "tcp",
|
||||
GRPCAddr: "127.0.0.1:9148",
|
||||
DebugAddr: "127.0.0.1:9149",
|
||||
Services: []string{"authprovider"},
|
||||
Endpoint: "localhost:9148",
|
||||
},
|
||||
AuthMachine: Port{
|
||||
GRPCNetwork: "tcp",
|
||||
GRPCAddr: "127.0.0.1:9166",
|
||||
DebugAddr: "127.0.0.1:9167",
|
||||
Services: []string{"authprovider"},
|
||||
Endpoint: "localhost:9166",
|
||||
},
|
||||
AuthMachineConfig: AuthMachineConfig{
|
||||
MachineAuthAPIKey: "change-me-please",
|
||||
},
|
||||
Sharing: Sharing{
|
||||
Port: Port{
|
||||
Endpoint: "localhost:9150",
|
||||
DebugAddr: "127.0.0.1:9151",
|
||||
GRPCNetwork: "tcp",
|
||||
GRPCAddr: "127.0.0.1:9150",
|
||||
Services: []string{"usershareprovider", "publicshareprovider"},
|
||||
},
|
||||
UserDriver: "json",
|
||||
UserJSONFile: path.Join(defaults.BaseDataPath(), "storage", "shares.json"),
|
||||
UserSQLUsername: "",
|
||||
UserSQLPassword: "",
|
||||
UserSQLHost: "",
|
||||
UserSQLPort: 1433,
|
||||
UserSQLName: "",
|
||||
PublicDriver: "json",
|
||||
PublicJSONFile: path.Join(defaults.BaseDataPath(), "storage", "publicshares.json"),
|
||||
PublicPasswordHashCost: 11,
|
||||
PublicEnableExpiredSharesCleanup: true,
|
||||
PublicJanitorRunInterval: 60,
|
||||
UserStorageMountID: "",
|
||||
},
|
||||
StorageHome: StoragePort{
|
||||
Port: Port{
|
||||
Endpoint: "localhost:9154",
|
||||
DebugAddr: "127.0.0.1:9156",
|
||||
GRPCNetwork: "tcp",
|
||||
GRPCAddr: "127.0.0.1:9154",
|
||||
HTTPNetwork: "tcp",
|
||||
HTTPAddr: "127.0.0.1:9155",
|
||||
},
|
||||
Driver: "ocis",
|
||||
ReadOnly: false,
|
||||
MountPath: "/home",
|
||||
AlternativeID: "1284d238-aa92-42ce-bdc4-0b0000009154",
|
||||
MountID: "1284d238-aa92-42ce-bdc4-0b0000009157",
|
||||
DataServerURL: "http://localhost:9155/data",
|
||||
HTTPPrefix: "data",
|
||||
TempFolder: path.Join(defaults.BaseDataPath(), "tmp", "home"),
|
||||
},
|
||||
StorageUsers: StoragePort{
|
||||
Port: Port{
|
||||
Endpoint: "localhost:9157",
|
||||
DebugAddr: "127.0.0.1:9159",
|
||||
GRPCNetwork: "tcp",
|
||||
GRPCAddr: "127.0.0.1:9157",
|
||||
HTTPNetwork: "tcp",
|
||||
HTTPAddr: "127.0.0.1:9158",
|
||||
},
|
||||
MountPath: "/users",
|
||||
MountID: "1284d238-aa92-42ce-bdc4-0b0000009157",
|
||||
Driver: "ocis",
|
||||
DataServerURL: "http://localhost:9158/data",
|
||||
HTTPPrefix: "data",
|
||||
TempFolder: path.Join(defaults.BaseDataPath(), "tmp", "users"),
|
||||
},
|
||||
StoragePublicLink: PublicStorage{
|
||||
StoragePort: StoragePort{
|
||||
Port: Port{
|
||||
Endpoint: "localhost:9178",
|
||||
DebugAddr: "127.0.0.1:9179",
|
||||
GRPCNetwork: "tcp",
|
||||
GRPCAddr: "127.0.0.1:9178",
|
||||
},
|
||||
MountPath: "/public",
|
||||
MountID: "e1a73ede-549b-4226-abdf-40e69ca8230d",
|
||||
},
|
||||
PublicShareProviderAddr: "",
|
||||
UserProviderAddr: "",
|
||||
},
|
||||
StorageMetadata: StoragePort{
|
||||
Port: Port{
|
||||
GRPCNetwork: "tcp",
|
||||
GRPCAddr: "127.0.0.1:9215",
|
||||
HTTPNetwork: "tcp",
|
||||
HTTPAddr: "127.0.0.1:9216",
|
||||
DebugAddr: "127.0.0.1:9217",
|
||||
},
|
||||
Driver: "ocis",
|
||||
ExposeDataServer: false,
|
||||
DataServerURL: "http://localhost:9216/data",
|
||||
TempFolder: path.Join(defaults.BaseDataPath(), "tmp", "metadata"),
|
||||
DataProvider: DataProvider{},
|
||||
},
|
||||
AppProvider: AppProvider{
|
||||
Port: Port{
|
||||
GRPCNetwork: "tcp",
|
||||
GRPCAddr: "127.0.0.1:9164",
|
||||
DebugAddr: "127.0.0.1:9165",
|
||||
Endpoint: "localhost:9164",
|
||||
Services: []string{"appprovider"},
|
||||
},
|
||||
ExternalAddr: "127.0.0.1:9164",
|
||||
WopiDriver: WopiDriver{},
|
||||
AppsURL: "/app/list",
|
||||
OpenURL: "/app/open",
|
||||
NewURL: "/app/new",
|
||||
},
|
||||
Configs: nil,
|
||||
UploadMaxChunkSize: 1e+8,
|
||||
UploadHTTPMethodOverride: "",
|
||||
ChecksumSupportedTypes: []string{"sha1", "md5", "adler32"},
|
||||
ChecksumPreferredUploadType: "",
|
||||
DefaultUploadProtocol: "tus",
|
||||
},
|
||||
Tracing: Tracing{
|
||||
Service: "storage",
|
||||
Type: "jaeger",
|
||||
},
|
||||
Asset: Asset{},
|
||||
}
|
||||
}
|
||||
|
||||
// StructMappings binds a set of environment variables to a destination on cfg. Iterating over this set and editing the
|
||||
// Destination value of a binding will alter the original value, as it is a pointer to its memory address. This lets
|
||||
// us propagate changes easier.
|
||||
|
||||
9
storage/pkg/config/debug.go
Normal file
9
storage/pkg/config/debug.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package config
|
||||
|
||||
// Debug defines the available debug configuration.
|
||||
type Debug struct {
|
||||
Addr string `ocisConfig:"addr" env:"STORAGE_DEBUG_ADDR"`
|
||||
Token string `ocisConfig:"token" env:"STORAGE_DEBUG_TOKEN"`
|
||||
Pprof bool `ocisConfig:"pprof" env:"STORAGE_DEBUG_PPROF"`
|
||||
Zpages bool `ocisConfig:"zpages" env:"STORAGE_DEBUG_ZPAGES"`
|
||||
}
|
||||
443
storage/pkg/config/defaultconfig.go
Normal file
443
storage/pkg/config/defaultconfig.go
Normal file
@@ -0,0 +1,443 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/config/defaults"
|
||||
)
|
||||
|
||||
func DefaultConfig() *Config {
|
||||
return &Config{
|
||||
// log is inherited
|
||||
Debug: Debug{
|
||||
Addr: "127.0.0.1:9109",
|
||||
},
|
||||
Reva: Reva{
|
||||
JWTSecret: "Pive-Fumkiu4",
|
||||
SkipUserGroupsInToken: false,
|
||||
TransferSecret: "replace-me-with-a-transfer-secret",
|
||||
TransferExpires: 24 * 60 * 60,
|
||||
OIDC: OIDC{
|
||||
Issuer: "https://localhost:9200",
|
||||
Insecure: false,
|
||||
IDClaim: "preferred_username",
|
||||
},
|
||||
LDAP: LDAP{
|
||||
Hostname: "localhost",
|
||||
Port: 9126,
|
||||
CACert: path.Join(defaults.BaseDataPath(), "ldap", "ldap.crt"),
|
||||
Insecure: false,
|
||||
BaseDN: "dc=ocis,dc=test",
|
||||
LoginFilter: "(&(objectclass=posixAccount)(|(cn={{login}})(mail={{login}})))",
|
||||
UserFilter: "(&(objectclass=posixAccount)(|(ownclouduuid={{.OpaqueId}})(cn={{.OpaqueId}})))",
|
||||
UserAttributeFilter: "(&(objectclass=posixAccount)({{attr}}={{value}}))",
|
||||
UserFindFilter: "(&(objectclass=posixAccount)(|(cn={{query}}*)(displayname={{query}}*)(mail={{query}}*)))",
|
||||
UserGroupFilter: "(&(objectclass=posixGroup)(ownclouduuid={{.OpaqueId}}*))",
|
||||
GroupFilter: "(&(objectclass=posixGroup)(|(ownclouduuid={{.OpaqueId}})(cn={{.OpaqueId}})))",
|
||||
GroupAttributeFilter: "(&(objectclass=posixGroup)({{attr}}={{value}}))",
|
||||
GroupFindFilter: "(&(objectclass=posixGroup)(|(cn={{query}}*)(displayname={{query}}*)(mail={{query}}*)))",
|
||||
GroupMemberFilter: "(&(objectclass=posixAccount)(ownclouduuid={{.OpaqueId}}*))",
|
||||
BindDN: "cn=reva,ou=sysusers,dc=ocis,dc=test",
|
||||
BindPassword: "reva",
|
||||
IDP: "https://localhost:9200",
|
||||
UserSchema: LDAPUserSchema{
|
||||
UID: "ownclouduuid",
|
||||
Mail: "mail",
|
||||
DisplayName: "displayname",
|
||||
CN: "cn",
|
||||
UIDNumber: "uidnumber",
|
||||
GIDNumber: "gidnumber",
|
||||
},
|
||||
GroupSchema: LDAPGroupSchema{
|
||||
GID: "cn",
|
||||
Mail: "mail",
|
||||
DisplayName: "cn",
|
||||
CN: "cn",
|
||||
GIDNumber: "gidnumber",
|
||||
},
|
||||
},
|
||||
UserGroupRest: UserGroupRest{
|
||||
RedisAddress: "localhost:6379",
|
||||
},
|
||||
UserOwnCloudSQL: UserOwnCloudSQL{
|
||||
DBUsername: "owncloud",
|
||||
DBPassword: "secret",
|
||||
DBHost: "mysql",
|
||||
DBPort: 3306,
|
||||
DBName: "owncloud",
|
||||
Idp: "https://localhost:9200",
|
||||
Nobody: 90,
|
||||
JoinUsername: false,
|
||||
JoinOwnCloudUUID: false,
|
||||
EnableMedialSearch: false,
|
||||
},
|
||||
OCDav: OCDav{
|
||||
WebdavNamespace: "/home/",
|
||||
DavFilesNamespace: "/users/",
|
||||
},
|
||||
Archiver: Archiver{
|
||||
MaxNumFiles: 10000,
|
||||
MaxSize: 1073741824,
|
||||
ArchiverURL: "/archiver",
|
||||
},
|
||||
UserStorage: StorageConfig{
|
||||
EOS: DriverEOS{
|
||||
DriverCommon: DriverCommon{
|
||||
Root: "/eos/dockertest/reva",
|
||||
ShareFolder: "/Shares",
|
||||
UserLayout: "{{substr 0 1 .Username}}/{{.Username}}",
|
||||
},
|
||||
ShadowNamespace: "", // Defaults to path.Join(c.Namespace, ".shadow")
|
||||
UploadsNamespace: "", // Defaults to path.Join(c.Namespace, ".uploads")
|
||||
EosBinary: "/usr/bin/eos",
|
||||
XrdcopyBinary: "/usr/bin/xrdcopy",
|
||||
MasterURL: "root://eos-mgm1.eoscluster.cern.ch:1094",
|
||||
SlaveURL: "root://eos-mgm1.eoscluster.cern.ch:1094",
|
||||
CacheDirectory: os.TempDir(),
|
||||
GatewaySVC: "127.0.0.1:9142",
|
||||
},
|
||||
Local: DriverCommon{
|
||||
Root: path.Join(defaults.BaseDataPath(), "storage", "local", "users"),
|
||||
ShareFolder: "/Shares",
|
||||
UserLayout: "{{.Username}}",
|
||||
EnableHome: false,
|
||||
},
|
||||
OwnCloud: DriverOwnCloud{
|
||||
DriverCommon: DriverCommon{
|
||||
Root: path.Join(defaults.BaseDataPath(), "storage", "owncloud"),
|
||||
ShareFolder: "/Shares",
|
||||
UserLayout: "{{.Id.OpaqueId}}",
|
||||
EnableHome: false,
|
||||
},
|
||||
UploadInfoDir: path.Join(defaults.BaseDataPath(), "storage", "uploadinfo"),
|
||||
Redis: ":6379",
|
||||
Scan: true,
|
||||
},
|
||||
OwnCloudSQL: DriverOwnCloudSQL{
|
||||
DriverCommon: DriverCommon{
|
||||
Root: path.Join(defaults.BaseDataPath(), "storage", "owncloud"),
|
||||
ShareFolder: "/Shares",
|
||||
UserLayout: "{{.Username}}",
|
||||
EnableHome: false,
|
||||
},
|
||||
UploadInfoDir: path.Join(defaults.BaseDataPath(), "storage", "uploadinfo"),
|
||||
DBUsername: "owncloud",
|
||||
DBPassword: "owncloud",
|
||||
DBHost: "",
|
||||
DBPort: 3306,
|
||||
DBName: "owncloud",
|
||||
},
|
||||
S3: DriverS3{
|
||||
DriverCommon: DriverCommon{},
|
||||
Region: "default",
|
||||
AccessKey: "",
|
||||
SecretKey: "",
|
||||
Endpoint: "",
|
||||
Bucket: "",
|
||||
},
|
||||
S3NG: DriverS3NG{
|
||||
DriverCommon: DriverCommon{
|
||||
Root: path.Join(defaults.BaseDataPath(), "storage", "users"),
|
||||
ShareFolder: "/Shares",
|
||||
UserLayout: "{{.Id.OpaqueId}}",
|
||||
EnableHome: false,
|
||||
},
|
||||
ServiceUserUUID: "95cb8724-03b2-11eb-a0a6-c33ef8ef53ad",
|
||||
Region: "default",
|
||||
AccessKey: "",
|
||||
SecretKey: "",
|
||||
Endpoint: "",
|
||||
Bucket: "",
|
||||
},
|
||||
OCIS: DriverOCIS{
|
||||
DriverCommon: DriverCommon{
|
||||
Root: path.Join(defaults.BaseDataPath(), "storage", "users"),
|
||||
ShareFolder: "/Shares",
|
||||
UserLayout: "{{.Id.OpaqueId}}",
|
||||
},
|
||||
ServiceUserUUID: "95cb8724-03b2-11eb-a0a6-c33ef8ef53ad",
|
||||
},
|
||||
},
|
||||
MetadataStorage: StorageConfig{
|
||||
EOS: DriverEOS{
|
||||
DriverCommon: DriverCommon{
|
||||
Root: "/eos/dockertest/reva",
|
||||
ShareFolder: "/Shares",
|
||||
UserLayout: "{{substr 0 1 .Username}}/{{.Username}}",
|
||||
EnableHome: false,
|
||||
},
|
||||
ShadowNamespace: "",
|
||||
UploadsNamespace: "",
|
||||
EosBinary: "/usr/bin/eos",
|
||||
XrdcopyBinary: "/usr/bin/xrdcopy",
|
||||
MasterURL: "root://eos-mgm1.eoscluster.cern.ch:1094",
|
||||
GrpcURI: "",
|
||||
SlaveURL: "root://eos-mgm1.eoscluster.cern.ch:1094",
|
||||
CacheDirectory: os.TempDir(),
|
||||
EnableLogging: false,
|
||||
ShowHiddenSysFiles: false,
|
||||
ForceSingleUserMode: false,
|
||||
UseKeytab: false,
|
||||
SecProtocol: "",
|
||||
Keytab: "",
|
||||
SingleUsername: "",
|
||||
GatewaySVC: "127.0.0.1:9142",
|
||||
},
|
||||
Local: DriverCommon{
|
||||
Root: path.Join(defaults.BaseDataPath(), "storage", "local", "metadata"),
|
||||
},
|
||||
OwnCloud: DriverOwnCloud{},
|
||||
OwnCloudSQL: DriverOwnCloudSQL{},
|
||||
S3: DriverS3{
|
||||
DriverCommon: DriverCommon{},
|
||||
Region: "default",
|
||||
},
|
||||
S3NG: DriverS3NG{
|
||||
DriverCommon: DriverCommon{
|
||||
Root: path.Join(defaults.BaseDataPath(), "storage", "metadata"),
|
||||
ShareFolder: "",
|
||||
UserLayout: "{{.Id.OpaqueId}}",
|
||||
EnableHome: false,
|
||||
},
|
||||
ServiceUserUUID: "95cb8724-03b2-11eb-a0a6-c33ef8ef53ad",
|
||||
Region: "default",
|
||||
AccessKey: "",
|
||||
SecretKey: "",
|
||||
Endpoint: "",
|
||||
Bucket: "",
|
||||
},
|
||||
OCIS: DriverOCIS{
|
||||
DriverCommon: DriverCommon{
|
||||
Root: path.Join(defaults.BaseDataPath(), "storage", "metadata"),
|
||||
ShareFolder: "",
|
||||
UserLayout: "{{.Id.OpaqueId}}",
|
||||
EnableHome: false,
|
||||
},
|
||||
ServiceUserUUID: "95cb8724-03b2-11eb-a0a6-c33ef8ef53ad",
|
||||
},
|
||||
},
|
||||
Frontend: FrontendPort{
|
||||
Port: Port{
|
||||
MaxCPUs: "",
|
||||
LogLevel: "",
|
||||
GRPCNetwork: "",
|
||||
GRPCAddr: "",
|
||||
HTTPNetwork: "tcp",
|
||||
HTTPAddr: "127.0.0.1:9140",
|
||||
Protocol: "",
|
||||
Endpoint: "",
|
||||
DebugAddr: "127.0.0.1:9141",
|
||||
Services: []string{"datagateway", "ocdav", "ocs", "appprovider"},
|
||||
Config: nil,
|
||||
Context: nil,
|
||||
Supervised: false,
|
||||
},
|
||||
AppProviderInsecure: false,
|
||||
AppProviderPrefix: "",
|
||||
ArchiverInsecure: false,
|
||||
ArchiverPrefix: "archiver",
|
||||
DatagatewayPrefix: "data",
|
||||
Favorites: false,
|
||||
OCDavInsecure: false,
|
||||
OCDavPrefix: "",
|
||||
OCSPrefix: "ocs",
|
||||
OCSSharePrefix: "/Shares",
|
||||
OCSHomeNamespace: "/home",
|
||||
PublicURL: "https://localhost:9200",
|
||||
OCSCacheWarmupDriver: "",
|
||||
OCSAdditionalInfoAttribute: "{{.Mail}}",
|
||||
OCSResourceInfoCacheTTL: 0,
|
||||
Middleware: Middleware{},
|
||||
},
|
||||
DataGateway: DataGatewayPort{
|
||||
Port: Port{},
|
||||
PublicURL: "",
|
||||
},
|
||||
Gateway: Gateway{
|
||||
Port: Port{
|
||||
Endpoint: "127.0.0.1:9142",
|
||||
DebugAddr: "127.0.0.1:9143",
|
||||
GRPCNetwork: "tcp",
|
||||
GRPCAddr: "127.0.0.1:9142",
|
||||
},
|
||||
CommitShareToStorageGrant: true,
|
||||
CommitShareToStorageRef: true,
|
||||
DisableHomeCreationOnLogin: false,
|
||||
ShareFolder: "Shares",
|
||||
LinkGrants: "",
|
||||
HomeMapping: "",
|
||||
EtagCacheTTL: 0,
|
||||
},
|
||||
StorageRegistry: StorageRegistry{
|
||||
Driver: "static",
|
||||
HomeProvider: "/home",
|
||||
JSON: "",
|
||||
},
|
||||
AppRegistry: AppRegistry{
|
||||
Driver: "static",
|
||||
MimetypesJSON: "",
|
||||
},
|
||||
Users: Users{
|
||||
Port: Port{
|
||||
Endpoint: "localhost:9144",
|
||||
DebugAddr: "127.0.0.1:9145",
|
||||
GRPCNetwork: "tcp",
|
||||
GRPCAddr: "127.0.0.1:9144",
|
||||
Services: []string{"userprovider"},
|
||||
},
|
||||
Driver: "ldap",
|
||||
UserGroupsCacheExpiration: 5,
|
||||
},
|
||||
Groups: Groups{
|
||||
Port: Port{
|
||||
Endpoint: "localhost:9160",
|
||||
DebugAddr: "127.0.0.1:9161",
|
||||
GRPCNetwork: "tcp",
|
||||
GRPCAddr: "127.0.0.1:9160",
|
||||
Services: []string{"groupprovider"},
|
||||
},
|
||||
Driver: "ldap",
|
||||
GroupMembersCacheExpiration: 5,
|
||||
},
|
||||
AuthProvider: Users{
|
||||
Port: Port{},
|
||||
Driver: "ldap",
|
||||
UserGroupsCacheExpiration: 0,
|
||||
},
|
||||
AuthBasic: Port{
|
||||
GRPCNetwork: "tcp",
|
||||
GRPCAddr: "127.0.0.1:9146",
|
||||
DebugAddr: "127.0.0.1:9147",
|
||||
Services: []string{"authprovider"},
|
||||
Endpoint: "localhost:9146",
|
||||
},
|
||||
AuthBearer: Port{
|
||||
GRPCNetwork: "tcp",
|
||||
GRPCAddr: "127.0.0.1:9148",
|
||||
DebugAddr: "127.0.0.1:9149",
|
||||
Services: []string{"authprovider"},
|
||||
Endpoint: "localhost:9148",
|
||||
},
|
||||
AuthMachine: Port{
|
||||
GRPCNetwork: "tcp",
|
||||
GRPCAddr: "127.0.0.1:9166",
|
||||
DebugAddr: "127.0.0.1:9167",
|
||||
Services: []string{"authprovider"},
|
||||
Endpoint: "localhost:9166",
|
||||
},
|
||||
AuthMachineConfig: AuthMachineConfig{
|
||||
MachineAuthAPIKey: "change-me-please",
|
||||
},
|
||||
Sharing: Sharing{
|
||||
Port: Port{
|
||||
Endpoint: "localhost:9150",
|
||||
DebugAddr: "127.0.0.1:9151",
|
||||
GRPCNetwork: "tcp",
|
||||
GRPCAddr: "127.0.0.1:9150",
|
||||
Services: []string{"usershareprovider", "publicshareprovider"},
|
||||
},
|
||||
UserDriver: "json",
|
||||
UserJSONFile: path.Join(defaults.BaseDataPath(), "storage", "shares.json"),
|
||||
UserSQLUsername: "",
|
||||
UserSQLPassword: "",
|
||||
UserSQLHost: "",
|
||||
UserSQLPort: 1433,
|
||||
UserSQLName: "",
|
||||
PublicDriver: "json",
|
||||
PublicJSONFile: path.Join(defaults.BaseDataPath(), "storage", "publicshares.json"),
|
||||
PublicPasswordHashCost: 11,
|
||||
PublicEnableExpiredSharesCleanup: true,
|
||||
PublicJanitorRunInterval: 60,
|
||||
UserStorageMountID: "",
|
||||
},
|
||||
StorageHome: StoragePort{
|
||||
Port: Port{
|
||||
Endpoint: "localhost:9154",
|
||||
DebugAddr: "127.0.0.1:9156",
|
||||
GRPCNetwork: "tcp",
|
||||
GRPCAddr: "127.0.0.1:9154",
|
||||
HTTPNetwork: "tcp",
|
||||
HTTPAddr: "127.0.0.1:9155",
|
||||
},
|
||||
Driver: "ocis",
|
||||
ReadOnly: false,
|
||||
MountPath: "/home",
|
||||
AlternativeID: "1284d238-aa92-42ce-bdc4-0b0000009154",
|
||||
MountID: "1284d238-aa92-42ce-bdc4-0b0000009157",
|
||||
DataServerURL: "http://localhost:9155/data",
|
||||
HTTPPrefix: "data",
|
||||
TempFolder: path.Join(defaults.BaseDataPath(), "tmp", "home"),
|
||||
},
|
||||
StorageUsers: StoragePort{
|
||||
Port: Port{
|
||||
Endpoint: "localhost:9157",
|
||||
DebugAddr: "127.0.0.1:9159",
|
||||
GRPCNetwork: "tcp",
|
||||
GRPCAddr: "127.0.0.1:9157",
|
||||
HTTPNetwork: "tcp",
|
||||
HTTPAddr: "127.0.0.1:9158",
|
||||
},
|
||||
MountPath: "/users",
|
||||
MountID: "1284d238-aa92-42ce-bdc4-0b0000009157",
|
||||
Driver: "ocis",
|
||||
DataServerURL: "http://localhost:9158/data",
|
||||
HTTPPrefix: "data",
|
||||
TempFolder: path.Join(defaults.BaseDataPath(), "tmp", "users"),
|
||||
},
|
||||
StoragePublicLink: PublicStorage{
|
||||
StoragePort: StoragePort{
|
||||
Port: Port{
|
||||
Endpoint: "localhost:9178",
|
||||
DebugAddr: "127.0.0.1:9179",
|
||||
GRPCNetwork: "tcp",
|
||||
GRPCAddr: "127.0.0.1:9178",
|
||||
},
|
||||
MountPath: "/public",
|
||||
MountID: "e1a73ede-549b-4226-abdf-40e69ca8230d",
|
||||
},
|
||||
PublicShareProviderAddr: "",
|
||||
UserProviderAddr: "",
|
||||
},
|
||||
StorageMetadata: StoragePort{
|
||||
Port: Port{
|
||||
GRPCNetwork: "tcp",
|
||||
GRPCAddr: "127.0.0.1:9215",
|
||||
HTTPNetwork: "tcp",
|
||||
HTTPAddr: "127.0.0.1:9216",
|
||||
DebugAddr: "127.0.0.1:9217",
|
||||
},
|
||||
Driver: "ocis",
|
||||
ExposeDataServer: false,
|
||||
DataServerURL: "http://localhost:9216/data",
|
||||
TempFolder: path.Join(defaults.BaseDataPath(), "tmp", "metadata"),
|
||||
DataProvider: DataProvider{},
|
||||
},
|
||||
AppProvider: AppProvider{
|
||||
Port: Port{
|
||||
GRPCNetwork: "tcp",
|
||||
GRPCAddr: "127.0.0.1:9164",
|
||||
DebugAddr: "127.0.0.1:9165",
|
||||
Endpoint: "localhost:9164",
|
||||
Services: []string{"appprovider"},
|
||||
},
|
||||
ExternalAddr: "127.0.0.1:9164",
|
||||
WopiDriver: WopiDriver{},
|
||||
AppsURL: "/app/list",
|
||||
OpenURL: "/app/open",
|
||||
NewURL: "/app/new",
|
||||
},
|
||||
Configs: nil,
|
||||
UploadMaxChunkSize: 1e+8,
|
||||
UploadHTTPMethodOverride: "",
|
||||
ChecksumSupportedTypes: []string{"sha1", "md5", "adler32"},
|
||||
ChecksumPreferredUploadType: "",
|
||||
DefaultUploadProtocol: "tus",
|
||||
},
|
||||
Tracing: Tracing{
|
||||
Service: "storage",
|
||||
Type: "jaeger",
|
||||
},
|
||||
Asset: Asset{},
|
||||
}
|
||||
}
|
||||
7
storage/pkg/config/grpc.go
Normal file
7
storage/pkg/config/grpc.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package config
|
||||
|
||||
// GRPC defines the available grpc configuration.
|
||||
type GRPC struct {
|
||||
Addr string `ocisConfig:"addr" env:"SETTINGS_GRPC_ADDR"`
|
||||
Namespace string
|
||||
}
|
||||
18
storage/pkg/config/http.go
Normal file
18
storage/pkg/config/http.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package config
|
||||
|
||||
// HTTP defines the available http configuration.
|
||||
type HTTP struct {
|
||||
Addr string `ocisConfig:"addr" env:"SETTINGS_HTTP_ADDR"`
|
||||
Namespace string
|
||||
Root string `ocisConfig:"root" env:"SETTINGS_HTTP_ROOT"`
|
||||
CacheTTL int `ocisConfig:"cache_ttl" env:"SETTINGS_CACHE_TTL"`
|
||||
CORS CORS `ocisConfig:"cors"`
|
||||
}
|
||||
|
||||
// CORS defines the available cors configuration.
|
||||
type CORS struct {
|
||||
AllowedOrigins []string `ocisConfig:"allowed_origins"`
|
||||
AllowedMethods []string `ocisConfig:"allowed_methods"`
|
||||
AllowedHeaders []string `ocisConfig:"allowed_headers"`
|
||||
AllowCredentials bool `ocisConfig:"allowed_credentials"`
|
||||
}
|
||||
9
storage/pkg/config/log.go
Normal file
9
storage/pkg/config/log.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package config
|
||||
|
||||
// Log defines the available log configuration.
|
||||
type Log struct {
|
||||
Level string `mapstructure:"level" env:"OCIS_LOG_LEVEL;STORAGE_LOG_LEVEL"`
|
||||
Pretty bool `mapstructure:"pretty" env:"OCIS_LOG_PRETTY;STORAGE_LOG_PRETTY"`
|
||||
Color bool `mapstructure:"color" env:"OCIS_LOG_COLOR;STORAGE_LOG_COLOR"`
|
||||
File string `mapstructure:"file" env:"OCIS_LOG_FILE;STORAGE_LOG_FILE"`
|
||||
}
|
||||
6
storage/pkg/config/reva.go
Normal file
6
storage/pkg/config/reva.go
Normal file
@@ -0,0 +1,6 @@
|
||||
package config
|
||||
|
||||
// TokenManager is the config for using the reva token manager
|
||||
type TokenManager struct {
|
||||
JWTSecret string `ocisConfig:"jwt_secret" env:"OCIS_JWT_SECRET;SETTINGS_JWT_SECRET"`
|
||||
}
|
||||
7
storage/pkg/config/service.go
Normal file
7
storage/pkg/config/service.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package config
|
||||
|
||||
// Service defines the available service configuration.
|
||||
type Service struct {
|
||||
Name string
|
||||
Version string
|
||||
}
|
||||
10
storage/pkg/config/tracing.go
Normal file
10
storage/pkg/config/tracing.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package config
|
||||
|
||||
// Tracing defines the available tracing configuration.
|
||||
type Tracing struct {
|
||||
Enabled bool `ocisConfig:"enabled" env:"OCIS_TRACING_ENABLED;STORAGE_TRACING_ENABLED"`
|
||||
Type string `ocisConfig:"type" env:"OCIS_TRACING_TYPE;STORAGE_TRACING_TYPE"`
|
||||
Endpoint string `ocisConfig:"endpoint" env:"OCIS_TRACING_ENDPOINT;STORAGE_TRACING_ENDPOINT"`
|
||||
Collector string `ocisConfig:"collector" env:"OCIS_TRACING_COLLECTOR;STORAGE_TRACING_COLLECTOR"`
|
||||
Service string `ocisConfig:"service" env:"STORAGE_TRACING_SERVICE"` //TODO: should this be an ID? or the same as Service.Name?
|
||||
}
|
||||
@@ -2,51 +2,11 @@ package config
|
||||
|
||||
import (
|
||||
"context"
|
||||
"path"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/config/defaults"
|
||||
)
|
||||
|
||||
// Debug defines the available debug configuration.
|
||||
type Debug struct {
|
||||
Addr string `ocisConfig:"addr" env:"STORE_DEBUG_ADDR"`
|
||||
Token string `ocisConfig:"token" env:"STORE_DEBUG_TOKEN"`
|
||||
Pprof bool `ocisConfig:"pprof" env:"STORE_DEBUG_PPROF"`
|
||||
Zpages bool `ocisConfig:"zpages" env:"STORE_DEBUG_ZPAGES"`
|
||||
}
|
||||
|
||||
// GRPC defines the available grpc configuration.
|
||||
type GRPC struct {
|
||||
Addr string `ocisConfig:"addr" env:"STORE_GRPC_ADDR"`
|
||||
Namespace string
|
||||
}
|
||||
|
||||
// Service defines the available service configuration.
|
||||
type Service struct {
|
||||
Name string
|
||||
Version string
|
||||
}
|
||||
|
||||
// Tracing defines the available tracing configuration.
|
||||
type Tracing struct {
|
||||
Enabled bool `ocisConfig:"enabled" env:"OCIS_TRACING_ENABLED;STORE_TRACING_ENABLED"`
|
||||
Type string `ocisConfig:"type" env:"OCIS_TRACING_TYPE;STORE_TRACING_TYPE"`
|
||||
Endpoint string `ocisConfig:"endpoint" env:"OCIS_TRACING_ENDPOINT;STORE_TRACING_ENDPOINT"`
|
||||
Collector string `ocisConfig:"collector" env:"OCIS_TRACING_COLLECTOR;STORE_TRACING_COLLECTOR"`
|
||||
Service string `ocisConfig:"service" env:"STORE_TRACING_SERVICE"` //TODO: should this be an ID? or the same as Service.Name?
|
||||
}
|
||||
|
||||
// Log defines the available log configuration.
|
||||
type Log struct {
|
||||
Level string `mapstructure:"level" env:"OCIS_LOG_LEVEL;STORE_LOG_LEVEL"`
|
||||
Pretty bool `mapstructure:"pretty" env:"OCIS_LOG_PRETTY;STORE_LOG_PRETTY"`
|
||||
Color bool `mapstructure:"color" env:"OCIS_LOG_COLOR;STORE_LOG_COLOR"`
|
||||
File string `mapstructure:"file" env:"OCIS_LOG_FILE;STORE_LOG_FILE"`
|
||||
}
|
||||
|
||||
// Config combines all available configuration parts.
|
||||
type Config struct {
|
||||
Service Service `ocisConfig:"service"`
|
||||
Service Service
|
||||
|
||||
Tracing Tracing `ocisConfig:"tracing"`
|
||||
Log Log `ocisConfig:"log"`
|
||||
@@ -59,29 +19,3 @@ type Config struct {
|
||||
Context context.Context
|
||||
Supervised bool
|
||||
}
|
||||
|
||||
func DefaultConfig() *Config {
|
||||
return &Config{
|
||||
Debug: Debug{
|
||||
Addr: "127.0.0.1:9464",
|
||||
Token: "",
|
||||
Pprof: false,
|
||||
Zpages: false,
|
||||
},
|
||||
GRPC: GRPC{
|
||||
Addr: "127.0.0.1:9460",
|
||||
Namespace: "com.owncloud.api",
|
||||
},
|
||||
Service: Service{
|
||||
Name: "store",
|
||||
},
|
||||
Tracing: Tracing{
|
||||
Enabled: false,
|
||||
Type: "jaeger",
|
||||
Endpoint: "",
|
||||
Collector: "",
|
||||
Service: "store",
|
||||
},
|
||||
Datapath: path.Join(defaults.BaseDataPath(), "store"),
|
||||
}
|
||||
}
|
||||
|
||||
9
store/pkg/config/debug.go
Normal file
9
store/pkg/config/debug.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package config
|
||||
|
||||
// Debug defines the available debug configuration.
|
||||
type Debug struct {
|
||||
Addr string `ocisConfig:"addr" env:"STORE_DEBUG_ADDR"`
|
||||
Token string `ocisConfig:"token" env:"STORE_DEBUG_TOKEN"`
|
||||
Pprof bool `ocisConfig:"pprof" env:"STORE_DEBUG_PPROF"`
|
||||
Zpages bool `ocisConfig:"zpages" env:"STORE_DEBUG_ZPAGES"`
|
||||
}
|
||||
33
store/pkg/config/defaultconfig.go
Normal file
33
store/pkg/config/defaultconfig.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"path"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/config/defaults"
|
||||
)
|
||||
|
||||
func DefaultConfig() *Config {
|
||||
return &Config{
|
||||
Debug: Debug{
|
||||
Addr: "127.0.0.1:9464",
|
||||
Token: "",
|
||||
Pprof: false,
|
||||
Zpages: false,
|
||||
},
|
||||
GRPC: GRPC{
|
||||
Addr: "127.0.0.1:9460",
|
||||
Namespace: "com.owncloud.api",
|
||||
},
|
||||
Service: Service{
|
||||
Name: "store",
|
||||
},
|
||||
Tracing: Tracing{
|
||||
Enabled: false,
|
||||
Type: "jaeger",
|
||||
Endpoint: "",
|
||||
Collector: "",
|
||||
Service: "store",
|
||||
},
|
||||
Datapath: path.Join(defaults.BaseDataPath(), "store"),
|
||||
}
|
||||
}
|
||||
7
store/pkg/config/grpc.go
Normal file
7
store/pkg/config/grpc.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package config
|
||||
|
||||
// GRPC defines the available grpc configuration.
|
||||
type GRPC struct {
|
||||
Addr string `ocisConfig:"addr" env:"STORE_GRPC_ADDR"`
|
||||
Namespace string
|
||||
}
|
||||
9
store/pkg/config/log.go
Normal file
9
store/pkg/config/log.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package config
|
||||
|
||||
// Log defines the available log configuration.
|
||||
type Log struct {
|
||||
Level string `mapstructure:"level" env:"OCIS_LOG_LEVEL;STORE_LOG_LEVEL"`
|
||||
Pretty bool `mapstructure:"pretty" env:"OCIS_LOG_PRETTY;STORE_LOG_PRETTY"`
|
||||
Color bool `mapstructure:"color" env:"OCIS_LOG_COLOR;STORE_LOG_COLOR"`
|
||||
File string `mapstructure:"file" env:"OCIS_LOG_FILE;STORE_LOG_FILE"`
|
||||
}
|
||||
7
store/pkg/config/service.go
Normal file
7
store/pkg/config/service.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package config
|
||||
|
||||
// Service defines the available service configuration.
|
||||
type Service struct {
|
||||
Name string
|
||||
Version string
|
||||
}
|
||||
10
store/pkg/config/tracing.go
Normal file
10
store/pkg/config/tracing.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package config
|
||||
|
||||
// Tracing defines the available tracing configuration.
|
||||
type Tracing struct {
|
||||
Enabled bool `ocisConfig:"enabled" env:"OCIS_TRACING_ENABLED;STORE_TRACING_ENABLED"`
|
||||
Type string `ocisConfig:"type" env:"OCIS_TRACING_TYPE;STORE_TRACING_TYPE"`
|
||||
Endpoint string `ocisConfig:"endpoint" env:"OCIS_TRACING_ENDPOINT;STORE_TRACING_ENDPOINT"`
|
||||
Collector string `ocisConfig:"collector" env:"OCIS_TRACING_COLLECTOR;STORE_TRACING_COLLECTOR"`
|
||||
Service string `ocisConfig:"service" env:"STORE_TRACING_SERVICE"` //TODO: should this be an ID? or the same as Service.Name?
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user