add missing commands and unify service / namespace options
This commit is contained in:
@@ -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 webdav services from the registry: %v", err))
|
||||
return err
|
||||
|
||||
+12
-12
@@ -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.
|
||||
@@ -76,8 +76,9 @@ func DefaultConfig() *Config {
|
||||
Zpages: false,
|
||||
},
|
||||
HTTP: HTTP{
|
||||
Addr: "127.0.0.1:9115",
|
||||
Root: "/",
|
||||
Addr: "127.0.0.1:9115",
|
||||
Root: "/",
|
||||
Namespace: "com.owncloud.web",
|
||||
CORS: CORS{
|
||||
AllowedOrigins: []string{"*"},
|
||||
AllowedMethods: []string{"GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"},
|
||||
@@ -85,6 +86,9 @@ func DefaultConfig() *Config {
|
||||
AllowCredentials: true,
|
||||
},
|
||||
},
|
||||
Service: Service{
|
||||
Name: "webdav",
|
||||
},
|
||||
Tracing: Tracing{
|
||||
Enabled: false,
|
||||
Type: "jaeger",
|
||||
@@ -92,10 +96,6 @@ func DefaultConfig() *Config {
|
||||
Collector: "",
|
||||
Service: "webdav",
|
||||
},
|
||||
Service: Service{
|
||||
Name: "webdav",
|
||||
Namespace: "com.owncloud.web",
|
||||
},
|
||||
OcisPublicURL: "https://127.0.0.1:9200",
|
||||
WebdavNamespace: "/home",
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ func structMappings(cfg *Config) []shared.EnvBinding {
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"WEBDAV_HTTP_NAMESPACE"},
|
||||
Destination: &cfg.Service.Namespace,
|
||||
Destination: &cfg.HTTP.Namespace,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"WEBDAV_SERVICE_NAME"},
|
||||
|
||||
@@ -15,7 +15,7 @@ func Server(opts ...Option) (http.Service, error) {
|
||||
|
||||
service := http.NewService(
|
||||
http.Logger(options.Logger),
|
||||
http.Namespace(options.Config.Service.Namespace),
|
||||
http.Namespace(options.Config.HTTP.Namespace),
|
||||
http.Name(options.Config.Service.Name),
|
||||
http.Version(options.Config.Service.Version),
|
||||
http.Address(options.Config.HTTP.Addr),
|
||||
|
||||
Reference in New Issue
Block a user