mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-03-04 15:27:17 -05:00
added flags to server command
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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{}
|
||||
|
||||
Reference in New Issue
Block a user