add missing commands and unify service / namespace options

This commit is contained in:
Willy Kloucek
2021-11-24 18:30:20 +01: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 proxy services from the registry: %v", err))
return err
+15 -15
View File
@@ -26,18 +26,18 @@ type Debug struct {
// HTTP defines the available http configuration.
type HTTP struct {
Addr string `ocisConfig:"addr"`
Root string `ocisConfig:"root"`
TLSCert string `ocisConfig:"tls_cert"`
TLSKey string `ocisConfig:"tls_key"`
TLS bool `ocisConfig:"tls"`
Addr string `ocisConfig:"addr"`
Root string `ocisConfig:"root"`
Namespace string `ocisConfig:"namespace"`
TLSCert string `ocisConfig:"tls_cert"`
TLSKey string `ocisConfig:"tls_key"`
TLS bool `ocisConfig:"tls"`
}
// 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.
@@ -207,15 +207,15 @@ func DefaultConfig() *Config {
Token: "",
},
HTTP: HTTP{
Addr: "0.0.0.0:9200",
Root: "/",
TLSCert: path.Join(defaults.BaseDataPath(), "proxy", "server.crt"),
TLSKey: path.Join(defaults.BaseDataPath(), "proxy", "server.key"),
TLS: true,
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",
Namespace: "com.owncloud.web",
Name: "proxy",
},
Tracing: Tracing{
Type: "jaeger",
+10 -8
View File
@@ -101,15 +101,9 @@ func structMappings(cfg *Config) []shared.EnvBinding {
EnvVars: []string{"PROXY_HTTP_ROOT"},
Destination: &cfg.HTTP.Root,
},
// Service
{
EnvVars: []string{"PROXY_SERVICE_NAMESPACE"},
Destination: &cfg.Service.Namespace,
},
{
EnvVars: []string{"PROXY_SERVICE_NAME"},
Destination: &cfg.Service.Name,
EnvVars: []string{"PROXY_HTTP_NAMESPACE"},
Destination: &cfg.HTTP.Namespace,
},
{
EnvVars: []string{"PROXY_TRANSPORT_TLS_CERT"},
@@ -123,6 +117,14 @@ func structMappings(cfg *Config) []shared.EnvBinding {
EnvVars: []string{"PROXY_TLS"},
Destination: &cfg.HTTP.TLS,
},
// Service
{
EnvVars: []string{"PROXY_SERVICE_NAME"},
Destination: &cfg.Service.Name,
},
// Other
{
EnvVars: []string{"OCIS_JWT_SECRET", "PROXY_JWT_SECRET"},
Destination: &cfg.TokenManager.JWTSecret,
+2 -2
View File
@@ -43,11 +43,11 @@ func Server(opts ...Option) (svc.Service, error) {
service := svc.NewService(
svc.Name(options.Config.Service.Name),
svc.Version(options.Config.Service.Version),
svc.TLSConfig(tlsConfig),
svc.Logger(options.Logger),
svc.Namespace(options.Config.Service.Namespace),
svc.Version(options.Config.Service.Version),
svc.Address(options.Config.HTTP.Addr),
svc.Namespace(options.Config.HTTP.Namespace),
svc.Context(options.Context),
svc.Flags(options.Flags...),
)