use flags to configure the server

This commit is contained in:
A.Unger
2020-02-04 12:42:16 +01:00
parent 9dda684cf2
commit 50336301c4
+18 -4
View File
@@ -37,6 +37,21 @@ func Server(cfg *config.Config) *cli.Command {
EnvVars: []string{"OCIS_ACCOUNTS_MOUNT_PATH"},
Destination: &cfg.MountPath,
},
&cli.StringFlag{
Name: "name",
Value: "accounts",
Destination: &cfg.Server.Name,
},
&cli.StringFlag{
Name: "namespace",
Value: "com.owncloud",
Destination: &cfg.Server.Namespace,
},
&cli.StringFlag{
Name: "address",
Value: "localhost:9999",
Destination: &cfg.Server.Address,
},
},
Action: func(c *cli.Context) error {
gr := run.Group{}
@@ -44,12 +59,11 @@ func Server(cfg *config.Config) *cli.Command {
defer cancel()
service := grpc.NewService(
// TODO read all this from cfg
grpc.Context(ctx),
grpc.Config(cfg),
grpc.Name("accounts"),
grpc.Namespace("com.owncloud"),
grpc.Address("localhost:9999"),
grpc.Name(cfg.Server.Name),
grpc.Namespace(cfg.Server.Namespace),
grpc.Address(cfg.Server.Address),
)
gr.Add(func() error {