mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-05-01 16:30:02 -05:00
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.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
@@ -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",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
{
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user