diff --git a/pkg/command/server.go b/pkg/command/server.go index b997157eba..d27b9d01df 100644 --- a/pkg/command/server.go +++ b/pkg/command/server.go @@ -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() diff --git a/pkg/service/v0/service.go b/pkg/service/v0/service.go index 4a7c8fc2c5..f6789bce19 100644 --- a/pkg/service/v0/service.go +++ b/pkg/service/v0/service.go @@ -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{}