add missing commands and unify service / namespace options

This commit is contained in:
Willy Kloucek
2021-11-24 18:30:20 +01:00
parent de87f3160d
commit 6206fe2398
66 changed files with 515 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.GRPC.Namespace + "." + cfg.Service.Name)
if err != nil {
fmt.Println(fmt.Errorf("could not get store services from the registry: %v", err))
return err
+10 -10
View File
@@ -18,15 +18,15 @@ type Debug struct {
// GRPC defines the available grpc configuration.
type GRPC struct {
Addr string `ocisConfig:"addr"`
Root string `ocisConfig:"root"`
Addr string `ocisConfig:"addr"`
Root string `ocisConfig:"root"`
Namespace string `ocisConfig:"namespace"`
}
// 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.
@@ -67,7 +67,11 @@ func DefaultConfig() *Config {
Zpages: false,
},
GRPC: GRPC{
Addr: "127.0.0.1:9460",
Addr: "127.0.0.1:9460",
Namespace: "com.owncloud.api",
},
Service: Service{
Name: "store",
},
Tracing: Tracing{
Enabled: false,
@@ -77,10 +81,6 @@ func DefaultConfig() *Config {
Service: "store",
},
Datapath: path.Join(defaults.BaseDataPath(), "store"),
Service: Service{
Name: "store",
Namespace: "com.owncloud.api",
},
}
}
+2 -2
View File
@@ -66,14 +66,14 @@ func structMappings(cfg *Config) []shared.EnvBinding {
},
{
EnvVars: []string{"STORE_GRPC_NAMESPACE"},
Destination: &cfg.Service.Namespace,
Destination: &cfg.GRPC.Namespace,
},
{
EnvVars: []string{"STORE_GRPC_ADDR"},
Destination: &cfg.GRPC.Addr,
},
{
EnvVars: []string{"STORE_NAME"},
EnvVars: []string{"STORE_SERVICE_NAME"},
Destination: &cfg.Service.Name,
},
{
+1 -1
View File
@@ -11,7 +11,7 @@ func Server(opts ...Option) grpc.Service {
options := newOptions(opts...)
service := grpc.NewService(
grpc.Namespace(options.Config.Service.Namespace),
grpc.Namespace(options.Config.GRPC.Namespace),
grpc.Name(options.Config.Service.Name),
grpc.Version(options.Config.Service.Version),
grpc.Context(options.Context),
+1 -1
View File
@@ -49,7 +49,7 @@ func New(opts ...Option) (s *Service, err error) {
indexMapping.DefaultAnalyzer = keyword.Name
s = &Service{
id: cfg.Service.Namespace + "." + cfg.Service.Name,
id: cfg.GRPC.Namespace + "." + cfg.Service.Name,
log: logger,
Config: cfg,
}