added flags to server command

This commit is contained in:
A.Unger
2020-02-04 11:54:45 +01:00
parent 2ff87de71f
commit 79aaba63fc
2 changed files with 23 additions and 2 deletions

View File

@@ -3,6 +3,8 @@ package command
import (
"context"
"fmt"
"os"
"path/filepath"
"syscall"
"github.com/micro/cli/v2"
@@ -13,15 +15,35 @@ import (
// Server is the entry point for the server command.
func Server(cfg *config.Config) *cli.Command {
baseDir, _ := filepath.Abs(filepath.Dir(os.Args[0]))
return &cli.Command{
Name: "server",
Usage: "Start accounts service",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "manager",
DefaultText: "filesystem",
Usage: "store controller driver. eg: filesystem",
Value: "filesystem",
EnvVars: []string{"OCIS_ACCOUNTS_MANAGER"},
Destination: &cfg.Manager,
},
&cli.StringFlag{
Name: "mount-path",
DefaultText: "binary default running location",
Usage: "where to mount the ocis accounts store",
Value: baseDir,
EnvVars: []string{"OCIS_ACCOUNTS_MOUNT_PATH"},
Destination: &cfg.MountPath,
},
},
Action: func(c *cli.Context) error {
gr := run.Group{}
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
service := grpc.NewService(ctx)
service := grpc.NewService(ctx, cfg)
gr.Add(func() error {
return service.Run()

View File

@@ -44,7 +44,6 @@ func (s Service) Set(c context.Context, req *proto.Record, res *proto.Record) er
// Get implements the SettingsServiceHandler interface
func (s Service) Get(c context.Context, req *proto.Query, res *proto.Record) error {
// contents, err := registry.Store.Read(req.Key)
contents := s.Manager.Read(req.Key)
r := &proto.Payload{}