add missing commands and unify service / namespace options

This commit is contained in:
Willy Kloucek
2022-01-07 15:38:56 +00:00
committed by Jörn Friedrich Dreyer
parent 6621ac2ef6
commit 3b5a33590e
66 changed files with 516 additions and 218 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ func PrintVersion(cfg *config.Config) *cli.Command {
},
Action: func(c *cli.Context) error {
reg := registry.GetRegistry()
services, err := reg.GetService(cfg.Service.Namespace + "." + cfg.Service.Name)
services, err := reg.GetService(cfg.HTTP.Namespace + "." + cfg.Service.Name)
if err != nil {
fmt.Println(fmt.Errorf("could not get ocs services from the registry: %v", err))
return err
+12 -12
View File
@@ -24,16 +24,16 @@ type CORS struct {
// HTTP defines the available http configuration.
type HTTP struct {
Addr string `ocisConfig:"addr"`
Root string `ocisConfig:"root"`
CORS CORS `ocisConfig:"cors"`
Addr string `ocisConfig:"addr"`
Root string `ocisConfig:"root"`
Namespace string `ocisConfig:"namespace"`
CORS CORS `ocisConfig:"cors"`
}
// Service defines the available service configuration.
type Service struct {
Name string `ocisConfig:"name"`
Namespace string `ocisConfig:"namespace"`
Version string `ocisConfig:"version"`
Name string `ocisConfig:"name"`
Version string `ocisConfig:"version"`
}
// Tracing defines the available tracing configuration.
@@ -98,8 +98,9 @@ func DefaultConfig() *Config {
Zpages: false,
},
HTTP: HTTP{
Addr: "127.0.0.1:9110",
Root: "/ocs",
Addr: "127.0.0.1:9110",
Root: "/ocs",
Namespace: "com.owncloud.web",
CORS: CORS{
AllowedOrigins: []string{"*"},
AllowedMethods: []string{"GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"},
@@ -107,6 +108,9 @@ func DefaultConfig() *Config {
AllowCredentials: true,
},
},
Service: Service{
Name: "ocs",
},
Tracing: Tracing{
Enabled: false,
Type: "jaeger",
@@ -117,10 +121,6 @@ func DefaultConfig() *Config {
TokenManager: TokenManager{
JWTSecret: "Pive-Fumkiu4",
},
Service: Service{
Name: "ocs",
Namespace: "com.owncloud.web",
},
AccountBackend: "accounts",
Reva: Reva{Address: "127.0.0.1:9142"},
StorageUsersDriver: "ocis",
+3 -3
View File
@@ -84,11 +84,11 @@ func structMappings(cfg *Config) []shared.EnvBinding {
Destination: &cfg.HTTP.Addr,
},
{
EnvVars: []string{"OCS_NAMESPACE"},
Destination: &cfg.Service.Namespace,
EnvVars: []string{"OCS_HTTP_NAMESPACE"},
Destination: &cfg.HTTP.Namespace,
},
{
EnvVars: []string{"OCS_NAME"},
EnvVars: []string{"OCS_SERVICE_NAME"},
Destination: &cfg.Service.Name,
},
{
+1 -1
View File
@@ -18,7 +18,7 @@ func Server(opts ...Option) (http.Service, error) {
http.Logger(options.Logger),
http.Name(options.Config.Service.Name),
http.Version(options.Config.Service.Version),
http.Namespace(options.Config.Service.Namespace),
http.Namespace(options.Config.HTTP.Namespace),
http.Address(options.Config.HTTP.Addr),
http.Context(options.Context),
http.Flags(options.Flags...),