diff --git a/go.mod b/go.mod index 74500be87..b05de8a70 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/go-log/log v0.2.0 // indirect github.com/gofrs/uuid v3.2.0+incompatible github.com/golang/groupcache v0.0.0-20191027212112-611e8accdfc9 // indirect - github.com/micro/cli v0.2.0 + github.com/micro/cli/v2 v2.1.1 github.com/micro/go-micro v1.18.0 // indirect github.com/oklog/run v1.0.0 github.com/owncloud/ocis-pkg v1.2.1-0.20191217084055-eab942498596 @@ -21,7 +21,7 @@ require ( github.com/spf13/viper v1.6.1 github.com/uber/jaeger-client-go v2.20.1+incompatible // indirect golang.org/x/crypto v0.0.0-20191227163750-53104e6ec876 // indirect - golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553 + golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553 // indirect golang.org/x/sys v0.0.0-20200103143344-a1369afcdac7 // indirect google.golang.org/api v0.14.0 // indirect google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb // indirect diff --git a/go.sum b/go.sum index 75f3864ed..ba252d3a7 100644 --- a/go.sum +++ b/go.sum @@ -162,6 +162,7 @@ github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7 github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f h1:lBNOc5arjvs8E5mO2tbpBpLoyyu8B6e44T7hJy6potg= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cpu/goacmedns v0.0.1/go.mod h1:sesf/pNnCYwUevQEQfEwY0Y3DydlQWSGZbaMElOWxok= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/cs3org/go-cs3apis v0.0.0-20191128165347-19746c015c83 h1:9bcp1jc6+36XUfuOae/w0BVrbzeVKBp/OqhTfCal40U= @@ -467,6 +468,8 @@ github.com/mholt/certmagic v0.7.5/go.mod h1:91uJzK5K8IWtYQqTi5R2tsxV1pCde+wdGfaR github.com/mholt/certmagic v0.8.3/go.mod h1:91uJzK5K8IWtYQqTi5R2tsxV1pCde+wdGfaRaOZi6aQ= github.com/micro/cli v0.2.0 h1:ut3rV5JWqZjsXIa2MvGF+qMUP8DAUTvHX9Br5gO4afA= github.com/micro/cli v0.2.0/go.mod h1:jRT9gmfVKWSS6pkKcXQ8YhUyj6bzwxK8Fp5b0Y7qNnk= +github.com/micro/cli/v2 v2.1.1 h1:uFw0SMIKmGuyHIm8lXns/NOn7V62bM5y7DnlxUM+BEQ= +github.com/micro/cli/v2 v2.1.1/go.mod h1:EguNh6DAoWKm9nmk+k/Rg0H3lQnDxqzu5x5srOtGtYg= github.com/micro/go-micro v1.16.0/go.mod h1:A0F58bHLh2m0LAI9QyhvmbN8c1cxhAZo3cM6s+iDsrM= github.com/micro/go-micro v1.17.1/go.mod h1:klwUJL1gkdY1MHFyz+fFJXn52dKcty4hoe95Mp571AA= github.com/micro/go-micro v1.18.0 h1:gP70EZVHpJuUIT0YWth192JmlIci+qMOEByHm83XE9E= @@ -538,6 +541,7 @@ github.com/nsqio/go-nsq v1.0.7/go.mod h1:XP5zaUs3pqf+Q71EqUJs3HYfBIqfK6G83WQMdNN github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/oleiade/reflections v1.0.0 h1:0ir4pc6v8/PJ0yw5AEtMddfXpWBXg9cnG7SgSoJuCgY= github.com/oleiade/reflections v1.0.0/go.mod h1:RbATFBbKYkVdqmSFtx13Bb/tVhR0lgOBXunWTZKeL4w= github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= @@ -641,6 +645,7 @@ github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= github.com/rs/zerolog v1.17.2 h1:RMRHFw2+wF7LO0QqtELQwo8hqSmqISyCJeFeAAuWcRo= github.com/rs/zerolog v1.17.2/go.mod h1:9nvC1axdVrAHcu/s9taAVfBuIdTZLVQmKQyvrUjF5+I= +github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= @@ -652,6 +657,7 @@ github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdh github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/serenize/snaker v0.0.0-20171204205717-a683aaf2d516/go.mod h1:Yow6lPLSAXx2ifx470yD/nUe22Dv5vBvxK/UK9UUTVs= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= +github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= @@ -941,6 +947,7 @@ google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9Ywl google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1 h1:QzqyMA1tlu6CgqCDUtU9V+ZKhLFT2dkJuANu5QaxI3I= google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= diff --git a/pkg/command/authbasic.go b/pkg/command/authbasic.go index 16a5fb917..f68478db4 100644 --- a/pkg/command/authbasic.go +++ b/pkg/command/authbasic.go @@ -9,7 +9,7 @@ import ( "github.com/cs3org/reva/cmd/revad/runtime" "github.com/gofrs/uuid" - "github.com/micro/cli" + "github.com/micro/cli/v2" "github.com/oklog/run" "github.com/owncloud/ocis-reva/pkg/config" "github.com/owncloud/ocis-reva/pkg/flagset" @@ -17,11 +17,16 @@ import ( ) // AuthBasic is the entrypoint for the auth-basic command. -func AuthBasic(cfg *config.Config) cli.Command { - return cli.Command{ +func AuthBasic(cfg *config.Config) *cli.Command { + return &cli.Command{ Name: "auth-basic", Usage: "Start reva authprovider for basic auth", Flags: flagset.AuthBasicWithConfig(cfg), + Before: func(c *cli.Context) error { + cfg.Reva.AuthBasic.Services = c.StringSlice("service") + + return nil + }, Action: func(c *cli.Context) error { logger := NewLogger(cfg) diff --git a/pkg/command/authbearer.go b/pkg/command/authbearer.go index b1ee497ca..299afb4c3 100644 --- a/pkg/command/authbearer.go +++ b/pkg/command/authbearer.go @@ -9,7 +9,7 @@ import ( "github.com/cs3org/reva/cmd/revad/runtime" "github.com/gofrs/uuid" - "github.com/micro/cli" + "github.com/micro/cli/v2" "github.com/oklog/run" "github.com/owncloud/ocis-reva/pkg/config" "github.com/owncloud/ocis-reva/pkg/flagset" @@ -17,11 +17,16 @@ import ( ) // AuthBearer is the entrypoint for the auth-bearer command. -func AuthBearer(cfg *config.Config) cli.Command { - return cli.Command{ +func AuthBearer(cfg *config.Config) *cli.Command { + return &cli.Command{ Name: "auth-bearer", Usage: "Start reva authprovider for bearer auth", Flags: flagset.AuthBearerWithConfig(cfg), + Before: func(c *cli.Context) error { + cfg.Reva.AuthBearer.Services = c.StringSlice("service") + + return nil + }, Action: func(c *cli.Context) error { logger := NewLogger(cfg) diff --git a/pkg/command/frontend.go b/pkg/command/frontend.go index bf2cf1d5a..fd7358907 100644 --- a/pkg/command/frontend.go +++ b/pkg/command/frontend.go @@ -10,7 +10,7 @@ import ( "github.com/cs3org/reva/cmd/revad/runtime" "github.com/gofrs/uuid" - "github.com/micro/cli" + "github.com/micro/cli/v2" "github.com/oklog/run" "github.com/owncloud/ocis-reva/pkg/config" "github.com/owncloud/ocis-reva/pkg/flagset" @@ -18,11 +18,16 @@ import ( ) // Frontend is the entrypoint for the frontend command. -func Frontend(cfg *config.Config) cli.Command { - return cli.Command{ +func Frontend(cfg *config.Config) *cli.Command { + return &cli.Command{ Name: "frontend", Usage: "Start reva frontend service", Flags: flagset.FrontendWithConfig(cfg), + Before: func(c *cli.Context) error { + cfg.Reva.Frontend.Services = c.StringSlice("service") + + return nil + }, Action: func(c *cli.Context) error { logger := NewLogger(cfg) diff --git a/pkg/command/gateway.go b/pkg/command/gateway.go index f3fe4a9b8..9019597dd 100644 --- a/pkg/command/gateway.go +++ b/pkg/command/gateway.go @@ -9,7 +9,7 @@ import ( "github.com/cs3org/reva/cmd/revad/runtime" "github.com/gofrs/uuid" - "github.com/micro/cli" + "github.com/micro/cli/v2" "github.com/oklog/run" "github.com/owncloud/ocis-reva/pkg/config" "github.com/owncloud/ocis-reva/pkg/flagset" @@ -17,11 +17,16 @@ import ( ) // Gateway is the entrypoint for the gateway command. -func Gateway(cfg *config.Config) cli.Command { - return cli.Command{ +func Gateway(cfg *config.Config) *cli.Command { + return &cli.Command{ Name: "gateway", Usage: "Start reva gateway", Flags: flagset.GatewayWithConfig(cfg), + Before: func(c *cli.Context) error { + cfg.Reva.Gateway.Services = c.StringSlice("service") + + return nil + }, Action: func(c *cli.Context) error { logger := NewLogger(cfg) diff --git a/pkg/command/health.go b/pkg/command/health.go index 546d1084f..36fe9f486 100644 --- a/pkg/command/health.go +++ b/pkg/command/health.go @@ -4,14 +4,14 @@ import ( "fmt" "net/http" - "github.com/micro/cli" + "github.com/micro/cli/v2" "github.com/owncloud/ocis-reva/pkg/config" "github.com/owncloud/ocis-reva/pkg/flagset" ) // Health is the entrypoint for the health command. -func Health(cfg *config.Config) cli.Command { - return cli.Command{ +func Health(cfg *config.Config) *cli.Command { + return &cli.Command{ Name: "health", Usage: "Check health status", Flags: flagset.HealthWithConfig(cfg), diff --git a/pkg/command/root.go b/pkg/command/root.go index c787b5fcc..dc4ed3069 100644 --- a/pkg/command/root.go +++ b/pkg/command/root.go @@ -4,7 +4,7 @@ import ( "os" "strings" - "github.com/micro/cli" + "github.com/micro/cli/v2" "github.com/owncloud/ocis-pkg/log" "github.com/owncloud/ocis-reva/pkg/config" "github.com/owncloud/ocis-reva/pkg/flagset" @@ -22,7 +22,7 @@ func Execute() error { Usage: "Example service for Reva/oCIS", Compiled: version.Compiled(), - Authors: []cli.Author{ + Authors: []*cli.Author{ { Name: "ownCloud GmbH", Email: "support@owncloud.com", @@ -73,7 +73,7 @@ func Execute() error { return nil }, - Commands: []cli.Command{ + Commands: []*cli.Command{ Frontend(cfg), Gateway(cfg), Users(cfg), diff --git a/pkg/command/sharing.go b/pkg/command/sharing.go index 4da067f85..123f830d9 100644 --- a/pkg/command/sharing.go +++ b/pkg/command/sharing.go @@ -9,7 +9,7 @@ import ( "github.com/cs3org/reva/cmd/revad/runtime" "github.com/gofrs/uuid" - "github.com/micro/cli" + "github.com/micro/cli/v2" "github.com/oklog/run" "github.com/owncloud/ocis-reva/pkg/config" "github.com/owncloud/ocis-reva/pkg/flagset" @@ -17,11 +17,16 @@ import ( ) // Sharing is the entrypoint for the sharing command. -func Sharing(cfg *config.Config) cli.Command { - return cli.Command{ +func Sharing(cfg *config.Config) *cli.Command { + return &cli.Command{ Name: "sharing", Usage: "Start reva sharing service", Flags: flagset.SharingWithConfig(cfg), + Before: func(c *cli.Context) error { + cfg.Reva.Sharing.Services = c.StringSlice("service") + + return nil + }, Action: func(c *cli.Context) error { logger := NewLogger(cfg) diff --git a/pkg/command/storagehome.go b/pkg/command/storagehome.go index 616560398..1310425d3 100644 --- a/pkg/command/storagehome.go +++ b/pkg/command/storagehome.go @@ -9,7 +9,7 @@ import ( "github.com/cs3org/reva/cmd/revad/runtime" "github.com/gofrs/uuid" - "github.com/micro/cli" + "github.com/micro/cli/v2" "github.com/oklog/run" "github.com/owncloud/ocis-reva/pkg/config" "github.com/owncloud/ocis-reva/pkg/flagset" @@ -17,11 +17,16 @@ import ( ) // StorageHome is the entrypoint for the storage-home command. -func StorageHome(cfg *config.Config) cli.Command { - return cli.Command{ +func StorageHome(cfg *config.Config) *cli.Command { + return &cli.Command{ Name: "storage-home", Usage: "Start reva storage-home service", Flags: flagset.StorageHomeWithConfig(cfg), + Before: func(c *cli.Context) error { + cfg.Reva.StorageHome.Services = c.StringSlice("service") + + return nil + }, Action: func(c *cli.Context) error { logger := NewLogger(cfg) diff --git a/pkg/command/storagehomedata.go b/pkg/command/storagehomedata.go index c3eba563e..d4a83a9b3 100644 --- a/pkg/command/storagehomedata.go +++ b/pkg/command/storagehomedata.go @@ -9,7 +9,7 @@ import ( "github.com/cs3org/reva/cmd/revad/runtime" "github.com/gofrs/uuid" - "github.com/micro/cli" + "github.com/micro/cli/v2" "github.com/oklog/run" "github.com/owncloud/ocis-reva/pkg/config" "github.com/owncloud/ocis-reva/pkg/flagset" @@ -17,11 +17,16 @@ import ( ) // StorageHomeData is the entrypoint for the storage-home-data command. -func StorageHomeData(cfg *config.Config) cli.Command { - return cli.Command{ +func StorageHomeData(cfg *config.Config) *cli.Command { + return &cli.Command{ Name: "storage-home-data", Usage: "Start reva storage-home-data service", Flags: flagset.StorageHomeDataWithConfig(cfg), + Before: func(c *cli.Context) error { + cfg.Reva.StorageHomeData.Services = c.StringSlice("service") + + return nil + }, Action: func(c *cli.Context) error { logger := NewLogger(cfg) diff --git a/pkg/command/storageoc.go b/pkg/command/storageoc.go index 06dda84d2..acc74c68c 100644 --- a/pkg/command/storageoc.go +++ b/pkg/command/storageoc.go @@ -9,7 +9,7 @@ import ( "github.com/cs3org/reva/cmd/revad/runtime" "github.com/gofrs/uuid" - "github.com/micro/cli" + "github.com/micro/cli/v2" "github.com/oklog/run" "github.com/owncloud/ocis-reva/pkg/config" "github.com/owncloud/ocis-reva/pkg/flagset" @@ -17,11 +17,16 @@ import ( ) // StorageOC is the entrypoint for the storage-oc command. -func StorageOC(cfg *config.Config) cli.Command { - return cli.Command{ +func StorageOC(cfg *config.Config) *cli.Command { + return &cli.Command{ Name: "storage-oc", Usage: "Start reva storage-oc service", Flags: flagset.StorageOCWithConfig(cfg), + Before: func(c *cli.Context) error { + cfg.Reva.StorageOC.Services = c.StringSlice("service") + + return nil + }, Action: func(c *cli.Context) error { logger := NewLogger(cfg) diff --git a/pkg/command/storageocdata.go b/pkg/command/storageocdata.go index 1af607dbc..45fbc719b 100644 --- a/pkg/command/storageocdata.go +++ b/pkg/command/storageocdata.go @@ -9,7 +9,7 @@ import ( "github.com/cs3org/reva/cmd/revad/runtime" "github.com/gofrs/uuid" - "github.com/micro/cli" + "github.com/micro/cli/v2" "github.com/oklog/run" "github.com/owncloud/ocis-reva/pkg/config" "github.com/owncloud/ocis-reva/pkg/flagset" @@ -17,11 +17,16 @@ import ( ) // StorageOCData is the entrypoint for the storage-oc-data command. -func StorageOCData(cfg *config.Config) cli.Command { - return cli.Command{ +func StorageOCData(cfg *config.Config) *cli.Command { + return &cli.Command{ Name: "storage-oc-data", Usage: "Start reva storage-oc-data service", Flags: flagset.StorageOCDataWithConfig(cfg), + Before: func(c *cli.Context) error { + cfg.Reva.StorageOCData.Services = c.StringSlice("service") + + return nil + }, Action: func(c *cli.Context) error { logger := NewLogger(cfg) diff --git a/pkg/command/storageroot.go b/pkg/command/storageroot.go index 005304219..12d99dbcc 100644 --- a/pkg/command/storageroot.go +++ b/pkg/command/storageroot.go @@ -9,7 +9,7 @@ import ( "github.com/cs3org/reva/cmd/revad/runtime" "github.com/gofrs/uuid" - "github.com/micro/cli" + "github.com/micro/cli/v2" "github.com/oklog/run" "github.com/owncloud/ocis-reva/pkg/config" "github.com/owncloud/ocis-reva/pkg/flagset" @@ -17,11 +17,16 @@ import ( ) // StorageRoot is the entrypoint for the storage-root command. -func StorageRoot(cfg *config.Config) cli.Command { - return cli.Command{ +func StorageRoot(cfg *config.Config) *cli.Command { + return &cli.Command{ Name: "storage-root", Usage: "Start reva storage-root service", Flags: flagset.StorageRootWithConfig(cfg), + Before: func(c *cli.Context) error { + cfg.Reva.StorageRoot.Services = c.StringSlice("service") + + return nil + }, Action: func(c *cli.Context) error { logger := NewLogger(cfg) diff --git a/pkg/command/users.go b/pkg/command/users.go index 4845032f9..18682258f 100644 --- a/pkg/command/users.go +++ b/pkg/command/users.go @@ -9,7 +9,7 @@ import ( "github.com/cs3org/reva/cmd/revad/runtime" "github.com/gofrs/uuid" - "github.com/micro/cli" + "github.com/micro/cli/v2" "github.com/oklog/run" "github.com/owncloud/ocis-reva/pkg/config" "github.com/owncloud/ocis-reva/pkg/flagset" @@ -17,11 +17,16 @@ import ( ) // Users is the entrypoint for the sharing command. -func Users(cfg *config.Config) cli.Command { - return cli.Command{ +func Users(cfg *config.Config) *cli.Command { + return &cli.Command{ Name: "users", Usage: "Start reva users service", Flags: flagset.UsersWithConfig(cfg), + Before: func(c *cli.Context) error { + cfg.Reva.Users.Services = c.StringSlice("service") + + return nil + }, Action: func(c *cli.Context) error { logger := NewLogger(cfg) diff --git a/pkg/config/config.go b/pkg/config/config.go index d40532e11..50c91f7cd 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -35,9 +35,7 @@ type Port struct { // DebugAddr for the debug endpoint to bind to DebugAddr string // Services can be used to give a list of services that should be started on this port - Services string - // used to store the parsed services - servicesList []string + Services []string // Config can be used to configure the reva instance. // Services and Protocol will be ignored if this is used Config map[string]interface{} diff --git a/pkg/flagset/authbasic.go b/pkg/flagset/authbasic.go index 13402d78f..8d4386561 100644 --- a/pkg/flagset/authbasic.go +++ b/pkg/flagset/authbasic.go @@ -1,7 +1,7 @@ package flagset import ( - "github.com/micro/cli" + "github.com/micro/cli/v2" "github.com/owncloud/ocis-reva/pkg/config" ) @@ -12,35 +12,35 @@ func AuthBasicWithConfig(cfg *config.Config) []cli.Flag { &cli.BoolFlag{ Name: "tracing-enabled", Usage: "Enable sending traces", - EnvVar: "REVA_TRACING_ENABLED", + EnvVars: []string{"REVA_TRACING_ENABLED"}, Destination: &cfg.Tracing.Enabled, }, &cli.StringFlag{ Name: "tracing-type", Value: "jaeger", Usage: "Tracing backend type", - EnvVar: "REVA_TRACING_TYPE", + EnvVars: []string{"REVA_TRACING_TYPE"}, Destination: &cfg.Tracing.Type, }, &cli.StringFlag{ Name: "tracing-endpoint", Value: "", Usage: "Endpoint for the agent", - EnvVar: "REVA_TRACING_ENDPOINT", + EnvVars: []string{"REVA_TRACING_ENDPOINT"}, Destination: &cfg.Tracing.Endpoint, }, &cli.StringFlag{ Name: "tracing-collector", Value: "", Usage: "Endpoint for the collector", - EnvVar: "REVA_TRACING_COLLECTOR", + EnvVars: []string{"REVA_TRACING_COLLECTOR"}, Destination: &cfg.Tracing.Collector, }, &cli.StringFlag{ Name: "tracing-service", Value: "reva", Usage: "Service name for tracing", - EnvVar: "REVA_TRACING_SERVICE", + EnvVars: []string{"REVA_TRACING_SERVICE"}, Destination: &cfg.Tracing.Service, }, @@ -49,26 +49,26 @@ func AuthBasicWithConfig(cfg *config.Config) []cli.Flag { Name: "debug-addr", Value: "0.0.0.0:9147", Usage: "Address to bind debug server", - EnvVar: "REVA_AUTH_BASIC_DEBUG_ADDR", + EnvVars: []string{"REVA_AUTH_BASIC_DEBUG_ADDR"}, Destination: &cfg.Reva.AuthBasic.DebugAddr, }, &cli.StringFlag{ Name: "debug-token", Value: "", Usage: "Token to grant metrics access", - EnvVar: "REVA_DEBUG_TOKEN", + EnvVars: []string{"REVA_DEBUG_TOKEN"}, Destination: &cfg.Debug.Token, }, &cli.BoolFlag{ Name: "debug-pprof", Usage: "Enable pprof debugging", - EnvVar: "REVA_DEBUG_PPROF", + EnvVars: []string{"REVA_DEBUG_PPROF"}, Destination: &cfg.Debug.Pprof, }, &cli.BoolFlag{ Name: "debug-zpages", Usage: "Enable zpages debugging", - EnvVar: "REVA_DEBUG_ZPAGES", + EnvVars: []string{"REVA_DEBUG_ZPAGES"}, Destination: &cfg.Debug.Zpages, }, @@ -78,7 +78,7 @@ func AuthBasicWithConfig(cfg *config.Config) []cli.Flag { Name: "jwt-secret", Value: "Pive-Fumkiu4", Usage: "Shared jwt secret for reva service communication", - EnvVar: "REVA_JWT_SECRET", + EnvVars: []string{"REVA_JWT_SECRET"}, Destination: &cfg.Reva.JWTSecret, }, @@ -88,14 +88,14 @@ func AuthBasicWithConfig(cfg *config.Config) []cli.Flag { Name: "users-driver", Value: "demo", Usage: "user driver: 'demo', 'json' or 'ldap'", - EnvVar: "REVA_USERS_DRIVER", + EnvVars: []string{"REVA_USERS_DRIVER"}, Destination: &cfg.Reva.Users.Driver, }, &cli.StringFlag{ Name: "users-json", Value: "", Usage: "Path to users.json file", - EnvVar: "REVA_USERS_JSON", + EnvVars: []string{"REVA_USERS_JSON"}, Destination: &cfg.Reva.Users.JSON, }, @@ -105,49 +105,49 @@ func AuthBasicWithConfig(cfg *config.Config) []cli.Flag { Name: "ldap-hostname", Value: "localhost", Usage: "LDAP hostname", - EnvVar: "REVA_LDAP_HOSTNAME", + EnvVars: []string{"REVA_LDAP_HOSTNAME"}, Destination: &cfg.Reva.LDAP.Hostname, }, &cli.IntFlag{ Name: "ldap-port", Value: 636, Usage: "LDAP port", - EnvVar: "REVA_LDAP_PORT", + EnvVars: []string{"REVA_LDAP_PORT"}, Destination: &cfg.Reva.LDAP.Port, }, &cli.StringFlag{ Name: "ldap-base-dn", Value: "dc=owncloud,dc=com", Usage: "LDAP basedn", - EnvVar: "REVA_LDAP_BASE_DN", + EnvVars: []string{"REVA_LDAP_BASE_DN"}, Destination: &cfg.Reva.LDAP.BaseDN, }, &cli.StringFlag{ Name: "ldap-userfilter", Value: "(&(objectclass=posixAccount)(cn=%s))", Usage: "LDAP userfilter", - EnvVar: "REVA_LDAP_USERFILTER", + EnvVars: []string{"REVA_LDAP_USERFILTER"}, Destination: &cfg.Reva.LDAP.UserFilter, }, &cli.StringFlag{ Name: "ldap-groupfilter", Value: "(&(objectclass=posixGroup)(cn=%s))", Usage: "LDAP groupfilter", - EnvVar: "REVA_LDAP_GROUPFILTER", + EnvVars: []string{"REVA_LDAP_GROUPFILTER"}, Destination: &cfg.Reva.LDAP.GroupFilter, }, &cli.StringFlag{ Name: "ldap-bind-dn", Value: "cn=admin,dc=owncloud,dc=com", Usage: "LDAP bind dn", - EnvVar: "REVA_LDAP_BIND_DN", + EnvVars: []string{"REVA_LDAP_BIND_DN"}, Destination: &cfg.Reva.LDAP.BindDN, }, &cli.StringFlag{ Name: "ldap-bind-password", Value: "admin", Usage: "LDAP bind password", - EnvVar: "REVA_LDAP_BIND_PASSWORD", + EnvVars: []string{"REVA_LDAP_BIND_PASSWORD"}, Destination: &cfg.Reva.LDAP.BindPassword, }, // ldap dn is always the dn @@ -155,28 +155,28 @@ func AuthBasicWithConfig(cfg *config.Config) []cli.Flag { Name: "ldap-schema-uid", Value: "uid", Usage: "LDAP schema uid", - EnvVar: "REVA_LDAP_SCHEMA_UID", + EnvVars: []string{"REVA_LDAP_SCHEMA_UID"}, Destination: &cfg.Reva.LDAP.Schema.UID, }, &cli.StringFlag{ Name: "ldap-schema-mail", Value: "mail", Usage: "LDAP schema mail", - EnvVar: "REVA_LDAP_SCHEMA_Mail", + EnvVars: []string{"REVA_LDAP_SCHEMA_Mail"}, Destination: &cfg.Reva.LDAP.Schema.Mail, }, &cli.StringFlag{ Name: "ldap-schema-displayName", Value: "displayName", Usage: "LDAP schema displayName", - EnvVar: "REVA_LDAP_SCHEMA_DISPLAYNAME", + EnvVars: []string{"REVA_LDAP_SCHEMA_DISPLAYNAME"}, Destination: &cfg.Reva.LDAP.Schema.DisplayName, }, &cli.StringFlag{ Name: "ldap-schema-cn", Value: "cn", Usage: "LDAP schema cn", - EnvVar: "REVA_LDAP_SCHEMA_CN", + EnvVars: []string{"REVA_LDAP_SCHEMA_CN"}, Destination: &cfg.Reva.LDAP.Schema.CN, }, @@ -188,36 +188,35 @@ func AuthBasicWithConfig(cfg *config.Config) []cli.Flag { Name: "network", Value: "tcp", Usage: "Network to use for the reva auth-basic service, can be 'tcp', 'udp' or 'unix'", - EnvVar: "REVA_AUTH_BASIC_NETWORK", + EnvVars: []string{"REVA_AUTH_BASIC_NETWORK"}, Destination: &cfg.Reva.AuthBasic.Network, }, &cli.StringFlag{ Name: "protocol", Value: "grpc", Usage: "protocol for reva service, can be 'http' or 'grpc'", - EnvVar: "REVA_AUTH_BASIC_PROTOCOL", + EnvVars: []string{"REVA_AUTH_BASIC_PROTOCOL"}, Destination: &cfg.Reva.AuthBasic.Protocol, }, &cli.StringFlag{ Name: "addr", Value: "0.0.0.0:9146", Usage: "Address to bind reva service", - EnvVar: "REVA_AUTH_BASIC_ADDR", + EnvVars: []string{"REVA_AUTH_BASIC_ADDR"}, Destination: &cfg.Reva.AuthBasic.Addr, }, &cli.StringFlag{ Name: "url", Value: "localhost:9146", Usage: "URL to use for the reva service", - EnvVar: "REVA_AUTH_BASIC_URL", + EnvVars: []string{"REVA_AUTH_BASIC_URL"}, Destination: &cfg.Reva.AuthBasic.URL, }, - &cli.StringFlag{ - Name: "services", - Value: "authprovider", - Usage: "comma separated list of services to include", - EnvVar: "REVA_AUTH_BASIC_SERVICES", - Destination: &cfg.Reva.AuthBasic.Services, + &cli.StringSliceFlag{ + Name: "service", + Value: cli.NewStringSlice("authprovider"), + Usage: "--service authprovider [--service otherservice]", + EnvVars: []string{"REVA_AUTH_BASIC_SERVICES"}, }, } } diff --git a/pkg/flagset/authbearer.go b/pkg/flagset/authbearer.go index cb80938a9..6da420487 100644 --- a/pkg/flagset/authbearer.go +++ b/pkg/flagset/authbearer.go @@ -1,7 +1,7 @@ package flagset import ( - "github.com/micro/cli" + "github.com/micro/cli/v2" "github.com/owncloud/ocis-reva/pkg/config" ) @@ -12,35 +12,35 @@ func AuthBearerWithConfig(cfg *config.Config) []cli.Flag { &cli.BoolFlag{ Name: "tracing-enabled", Usage: "Enable sending traces", - EnvVar: "REVA_TRACING_ENABLED", + EnvVars: []string{"REVA_TRACING_ENABLED"}, Destination: &cfg.Tracing.Enabled, }, &cli.StringFlag{ Name: "tracing-type", Value: "jaeger", Usage: "Tracing backend type", - EnvVar: "REVA_TRACING_TYPE", + EnvVars: []string{"REVA_TRACING_TYPE"}, Destination: &cfg.Tracing.Type, }, &cli.StringFlag{ Name: "tracing-endpoint", Value: "", Usage: "Endpoint for the agent", - EnvVar: "REVA_TRACING_ENDPOINT", + EnvVars: []string{"REVA_TRACING_ENDPOINT"}, Destination: &cfg.Tracing.Endpoint, }, &cli.StringFlag{ Name: "tracing-collector", Value: "", Usage: "Endpoint for the collector", - EnvVar: "REVA_TRACING_COLLECTOR", + EnvVars: []string{"REVA_TRACING_COLLECTOR"}, Destination: &cfg.Tracing.Collector, }, &cli.StringFlag{ Name: "tracing-service", Value: "reva", Usage: "Service name for tracing", - EnvVar: "REVA_TRACING_SERVICE", + EnvVars: []string{"REVA_TRACING_SERVICE"}, Destination: &cfg.Tracing.Service, }, @@ -49,26 +49,26 @@ func AuthBearerWithConfig(cfg *config.Config) []cli.Flag { Name: "debug-addr", Value: "0.0.0.0:9149", Usage: "Address to bind debug server", - EnvVar: "REVA_AUTH_BEARER_DEBUG_ADDR", + EnvVars: []string{"REVA_AUTH_BEARER_DEBUG_ADDR"}, Destination: &cfg.Reva.AuthBearer.DebugAddr, }, &cli.StringFlag{ Name: "debug-token", Value: "", Usage: "Token to grant metrics access", - EnvVar: "REVA_DEBUG_TOKEN", + EnvVars: []string{"REVA_DEBUG_TOKEN"}, Destination: &cfg.Debug.Token, }, &cli.BoolFlag{ Name: "debug-pprof", Usage: "Enable pprof debugging", - EnvVar: "REVA_DEBUG_PPROF", + EnvVars: []string{"REVA_DEBUG_PPROF"}, Destination: &cfg.Debug.Pprof, }, &cli.BoolFlag{ Name: "debug-zpages", Usage: "Enable zpages debugging", - EnvVar: "REVA_DEBUG_ZPAGES", + EnvVars: []string{"REVA_DEBUG_ZPAGES"}, Destination: &cfg.Debug.Zpages, }, @@ -78,7 +78,7 @@ func AuthBearerWithConfig(cfg *config.Config) []cli.Flag { Name: "jwt-secret", Value: "Pive-Fumkiu4", Usage: "Shared jwt secret for reva service communication", - EnvVar: "REVA_JWT_SECRET", + EnvVars: []string{"REVA_JWT_SECRET"}, Destination: &cfg.Reva.JWTSecret, }, @@ -88,20 +88,20 @@ func AuthBearerWithConfig(cfg *config.Config) []cli.Flag { Name: "oidc-issuer", Value: "http://localhost:9140", Usage: "OIDC issuer", - EnvVar: "REVA_OIDC_ISSUER", + EnvVars: []string{"REVA_OIDC_ISSUER"}, Destination: &cfg.Reva.OIDC.Issuer, }, &cli.BoolFlag{ Name: "oidc-insecure", Usage: "OIDC allow insecure communication", - EnvVar: "REVA_OIDC_INSECURE", + EnvVars: []string{"REVA_OIDC_INSECURE"}, Destination: &cfg.Reva.OIDC.Insecure, }, &cli.StringFlag{ Name: "oidc-id-claim", Value: "sub", // sub is stable and defined as unique. the user manager needs to take care of the sub to user metadata lookup Usage: "OIDC id claim", - EnvVar: "REVA_OIDC_ID_CLAIM", + EnvVars: []string{"REVA_OIDC_ID_CLAIM"}, Destination: &cfg.Reva.OIDC.IDClaim, }, @@ -113,36 +113,35 @@ func AuthBearerWithConfig(cfg *config.Config) []cli.Flag { Name: "network", Value: "tcp", Usage: "Network to use for the reva service, can be 'tcp', 'udp' or 'unix'", - EnvVar: "REVA_AUTH_BEARER_NETWORK", + EnvVars: []string{"REVA_AUTH_BEARER_NETWORK"}, Destination: &cfg.Reva.AuthBearer.Network, }, &cli.StringFlag{ Name: "protocol", Value: "grpc", Usage: "protocol for reva service, can be 'http' or 'grpc'", - EnvVar: "REVA_AUTH_BEARER_PROTOCOL", + EnvVars: []string{"REVA_AUTH_BEARER_PROTOCOL"}, Destination: &cfg.Reva.AuthBearer.Protocol, }, &cli.StringFlag{ Name: "addr", Value: "0.0.0.0:9148", Usage: "Address to bind reva service", - EnvVar: "REVA_AUTH_BEARER_ADDR", + EnvVars: []string{"REVA_AUTH_BEARER_ADDR"}, Destination: &cfg.Reva.AuthBearer.Addr, }, &cli.StringFlag{ Name: "url", Value: "localhost:9148", Usage: "URL to use for the reva service", - EnvVar: "REVA_AUTH_BEARER_URL", + EnvVars: []string{"REVA_AUTH_BEARER_URL"}, Destination: &cfg.Reva.AuthBearer.URL, }, - &cli.StringFlag{ - Name: "services", - Value: "authprovider", // TODO preferences - Usage: "comma separated list of services to include", - EnvVar: "REVA_AUTH_BEARER_SERVICES", - Destination: &cfg.Reva.AuthBearer.Services, + &cli.StringSliceFlag{ + Name: "service", + Value: cli.NewStringSlice("authprovider"), // TODO preferences + Usage: "--service authprovider [--service otherservice]", + EnvVars: []string{"REVA_AUTH_BEARER_SERVICES"}, }, } } diff --git a/pkg/flagset/frontend.go b/pkg/flagset/frontend.go index 45d119a57..c85208622 100644 --- a/pkg/flagset/frontend.go +++ b/pkg/flagset/frontend.go @@ -1,7 +1,7 @@ package flagset import ( - "github.com/micro/cli" + "github.com/micro/cli/v2" "github.com/owncloud/ocis-reva/pkg/config" ) @@ -12,35 +12,35 @@ func FrontendWithConfig(cfg *config.Config) []cli.Flag { &cli.BoolFlag{ Name: "tracing-enabled", Usage: "Enable sending traces", - EnvVar: "REVA_TRACING_ENABLED", + EnvVars: []string{"REVA_TRACING_ENABLED"}, Destination: &cfg.Tracing.Enabled, }, &cli.StringFlag{ Name: "tracing-type", Value: "jaeger", Usage: "Tracing backend type", - EnvVar: "REVA_TRACING_TYPE", + EnvVars: []string{"REVA_TRACING_TYPE"}, Destination: &cfg.Tracing.Type, }, &cli.StringFlag{ Name: "tracing-endpoint", Value: "", Usage: "Endpoint for the agent", - EnvVar: "REVA_TRACING_ENDPOINT", + EnvVars: []string{"REVA_TRACING_ENDPOINT"}, Destination: &cfg.Tracing.Endpoint, }, &cli.StringFlag{ Name: "tracing-collector", Value: "", Usage: "Endpoint for the collector", - EnvVar: "REVA_TRACING_COLLECTOR", + EnvVars: []string{"REVA_TRACING_COLLECTOR"}, Destination: &cfg.Tracing.Collector, }, &cli.StringFlag{ Name: "tracing-service", Value: "reva", Usage: "Service name for tracing", - EnvVar: "REVA_TRACING_SERVICE", + EnvVars: []string{"REVA_TRACING_SERVICE"}, Destination: &cfg.Tracing.Service, }, @@ -49,26 +49,26 @@ func FrontendWithConfig(cfg *config.Config) []cli.Flag { Name: "debug-addr", Value: "0.0.0.0:9141", Usage: "Address to bind debug server", - EnvVar: "REVA_FRONTEND_DEBUG_ADDR", + EnvVars: []string{"REVA_FRONTEND_DEBUG_ADDR"}, Destination: &cfg.Reva.Frontend.DebugAddr, }, &cli.StringFlag{ Name: "debug-token", Value: "", Usage: "Token to grant metrics access", - EnvVar: "REVA_DEBUG_TOKEN", + EnvVars: []string{"REVA_DEBUG_TOKEN"}, Destination: &cfg.Debug.Token, }, &cli.BoolFlag{ Name: "debug-pprof", Usage: "Enable pprof debugging", - EnvVar: "REVA_DEBUG_PPROF", + EnvVars: []string{"REVA_DEBUG_PPROF"}, Destination: &cfg.Debug.Pprof, }, &cli.BoolFlag{ Name: "debug-zpages", Usage: "Enable zpages debugging", - EnvVar: "REVA_DEBUG_ZPAGES", + EnvVars: []string{"REVA_DEBUG_ZPAGES"}, Destination: &cfg.Debug.Zpages, }, @@ -78,14 +78,14 @@ func FrontendWithConfig(cfg *config.Config) []cli.Flag { Name: "jwt-secret", Value: "Pive-Fumkiu4", Usage: "Shared jwt secret for reva service communication", - EnvVar: "REVA_JWT_SECRET", + EnvVars: []string{"REVA_JWT_SECRET"}, Destination: &cfg.Reva.JWTSecret, }, &cli.StringFlag{ Name: "transfer-secret", Value: "replace-me-with-a-transfer-secret", Usage: "Transfer secret for datagateway", - EnvVar: "REVA_TRANSFER_SECRET", + EnvVars: []string{"REVA_TRANSFER_SECRET"}, Destination: &cfg.Reva.TransferSecret, }, @@ -95,20 +95,20 @@ func FrontendWithConfig(cfg *config.Config) []cli.Flag { Name: "oidc-issuer", Value: "http://localhost:9140", Usage: "OIDC issuer", - EnvVar: "REVA_OIDC_ISSUER", + EnvVars: []string{"REVA_OIDC_ISSUER"}, Destination: &cfg.Reva.OIDC.Issuer, }, &cli.BoolFlag{ Name: "oidc-insecure", Usage: "OIDC allow insecure communication", - EnvVar: "REVA_OIDC_INSECURE", + EnvVars: []string{"REVA_OIDC_INSECURE"}, Destination: &cfg.Reva.OIDC.Insecure, }, &cli.StringFlag{ Name: "oidc-id-claim", Value: "sub", // sub is stable and defined as unique. the user manager needs to take care of the sub to user metadata lookup Usage: "OIDC id claim", - EnvVar: "REVA_OIDC_ID_CLAIM", + EnvVars: []string{"REVA_OIDC_ID_CLAIM"}, Destination: &cfg.Reva.OIDC.IDClaim, }, @@ -122,36 +122,35 @@ func FrontendWithConfig(cfg *config.Config) []cli.Flag { Name: "network", Value: "tcp", Usage: "Network to use for the reva service, can be 'tcp', 'udp' or 'unix'", - EnvVar: "REVA_FRONTEND_NETWORK", + EnvVars: []string{"REVA_FRONTEND_NETWORK"}, Destination: &cfg.Reva.Frontend.Network, }, &cli.StringFlag{ Name: "protocol", Value: "http", Usage: "protocol for reva service, can be 'http' or 'grpc'", - EnvVar: "REVA_FRONTEND_PROTOCOL", + EnvVars: []string{"REVA_FRONTEND_PROTOCOL"}, Destination: &cfg.Reva.Frontend.Protocol, }, &cli.StringFlag{ Name: "addr", Value: "0.0.0.0:9140", Usage: "Address to bind reva service", - EnvVar: "REVA_FRONTEND_ADDR", + EnvVars: []string{"REVA_FRONTEND_ADDR"}, Destination: &cfg.Reva.Frontend.Addr, }, &cli.StringFlag{ Name: "url", Value: "localhost:9140", Usage: "URL to use for the reva service", - EnvVar: "REVA_FRONTEND_URL", + EnvVars: []string{"REVA_FRONTEND_URL"}, Destination: &cfg.Reva.Frontend.URL, }, - &cli.StringFlag{ - Name: "services", - Value: "datagateway,wellknown,oidcprovider,ocdav,ocs", - Usage: "comma separated list of services to include", - EnvVar: "REVA_FRONTEND_SERVICES", - Destination: &cfg.Reva.Frontend.Services, + &cli.StringSliceFlag{ + Name: "service", + Value: cli.NewStringSlice("datagateway", "wellknown", "oidcprovider", "ocdav", "ocs"), + Usage: "--service datagateway [--service wellknown]", + EnvVars: []string{"REVA_FRONTEND_SERVICES"}, }, // Gateway @@ -160,7 +159,7 @@ func FrontendWithConfig(cfg *config.Config) []cli.Flag { Name: "gateway-url", Value: "localhost:9142", Usage: "URL to use for the reva gateway service", - EnvVar: "REVA_GATEWAY_URL", + EnvVars: []string{"REVA_GATEWAY_URL"}, Destination: &cfg.Reva.Gateway.URL, }, } diff --git a/pkg/flagset/gateway.go b/pkg/flagset/gateway.go index b85554624..38bc3e036 100644 --- a/pkg/flagset/gateway.go +++ b/pkg/flagset/gateway.go @@ -1,7 +1,7 @@ package flagset import ( - "github.com/micro/cli" + "github.com/micro/cli/v2" "github.com/owncloud/ocis-reva/pkg/config" ) @@ -12,35 +12,35 @@ func GatewayWithConfig(cfg *config.Config) []cli.Flag { &cli.BoolFlag{ Name: "tracing-enabled", Usage: "Enable sending traces", - EnvVar: "REVA_TRACING_ENABLED", + EnvVars: []string{"REVA_TRACING_ENABLED"}, Destination: &cfg.Tracing.Enabled, }, &cli.StringFlag{ Name: "tracing-type", Value: "jaeger", Usage: "Tracing backend type", - EnvVar: "REVA_TRACING_TYPE", + EnvVars: []string{"REVA_TRACING_TYPE"}, Destination: &cfg.Tracing.Type, }, &cli.StringFlag{ Name: "tracing-endpoint", Value: "", Usage: "Endpoint for the agent", - EnvVar: "REVA_TRACING_ENDPOINT", + EnvVars: []string{"REVA_TRACING_ENDPOINT"}, Destination: &cfg.Tracing.Endpoint, }, &cli.StringFlag{ Name: "tracing-collector", Value: "", Usage: "Endpoint for the collector", - EnvVar: "REVA_TRACING_COLLECTOR", + EnvVars: []string{"REVA_TRACING_COLLECTOR"}, Destination: &cfg.Tracing.Collector, }, &cli.StringFlag{ Name: "tracing-service", Value: "reva", Usage: "Service name for tracing", - EnvVar: "REVA_TRACING_SERVICE", + EnvVars: []string{"REVA_TRACING_SERVICE"}, Destination: &cfg.Tracing.Service, }, @@ -49,26 +49,26 @@ func GatewayWithConfig(cfg *config.Config) []cli.Flag { Name: "debug-addr", Value: "0.0.0.0:9143", Usage: "Address to bind debug server", - EnvVar: "REVA_GATEWAY_DEBUG_ADDR", + EnvVars: []string{"REVA_GATEWAY_DEBUG_ADDR"}, Destination: &cfg.Reva.Gateway.DebugAddr, }, &cli.StringFlag{ Name: "debug-token", Value: "", Usage: "Token to grant metrics access", - EnvVar: "REVA_DEBUG_TOKEN", + EnvVars: []string{"REVA_DEBUG_TOKEN"}, Destination: &cfg.Debug.Token, }, &cli.BoolFlag{ Name: "debug-pprof", Usage: "Enable pprof debugging", - EnvVar: "REVA_DEBUG_PPROF", + EnvVars: []string{"REVA_DEBUG_PPROF"}, Destination: &cfg.Debug.Pprof, }, &cli.BoolFlag{ Name: "debug-zpages", Usage: "Enable zpages debugging", - EnvVar: "REVA_DEBUG_ZPAGES", + EnvVars: []string{"REVA_DEBUG_ZPAGES"}, Destination: &cfg.Debug.Zpages, }, @@ -78,21 +78,21 @@ func GatewayWithConfig(cfg *config.Config) []cli.Flag { Name: "jwt-secret", Value: "Pive-Fumkiu4", Usage: "Shared jwt secret for reva service communication", - EnvVar: "REVA_JWT_SECRET", + EnvVars: []string{"REVA_JWT_SECRET"}, Destination: &cfg.Reva.JWTSecret, }, &cli.StringFlag{ Name: "transfer-secret", Value: "replace-me-with-a-transfer-secret", Usage: "Transfer secret for datagateway", - EnvVar: "REVA_TRANSFER_SECRET", + EnvVars: []string{"REVA_TRANSFER_SECRET"}, Destination: &cfg.Reva.TransferSecret, }, &cli.IntFlag{ Name: "transfer-expires", Value: 10, Usage: "Transfer secret for datagateway", - EnvVar: "REVA_TRANSFER_EXPIRES", + EnvVars: []string{"REVA_TRANSFER_EXPIRES"}, Destination: &cfg.Reva.TransferExpires, }, @@ -106,42 +106,41 @@ func GatewayWithConfig(cfg *config.Config) []cli.Flag { Name: "network", Value: "tcp", Usage: "Network to use for the reva service, can be 'tcp', 'udp' or 'unix'", - EnvVar: "REVA_GATEWAY_NETWORK", + EnvVars: []string{"REVA_GATEWAY_NETWORK"}, Destination: &cfg.Reva.Gateway.Network, }, &cli.StringFlag{ Name: "protocol", Value: "grpc", Usage: "protocol for reva service, can be 'http' or 'grpc'", - EnvVar: "REVA_GATEWAY_PROTOCOL", + EnvVars: []string{"REVA_GATEWAY_PROTOCOL"}, Destination: &cfg.Reva.Gateway.Protocol, }, &cli.StringFlag{ Name: "addr", Value: "0.0.0.0:9142", Usage: "Address to bind reva service", - EnvVar: "REVA_GATEWAY_ADDR", + EnvVars: []string{"REVA_GATEWAY_ADDR"}, Destination: &cfg.Reva.Gateway.Addr, }, &cli.StringFlag{ Name: "url", Value: "localhost:9142", Usage: "URL to use for the reva service", - EnvVar: "REVA_GATEWAY_URL", + EnvVars: []string{"REVA_GATEWAY_URL"}, Destination: &cfg.Reva.Gateway.URL, }, - &cli.StringFlag{ - Name: "services", - Value: "gateway,authregistry,storageregistry", // TODO appregistry - Usage: "comma separated list of services to include", - EnvVar: "REVA_GATEWAY_SERVICES", - Destination: &cfg.Reva.Gateway.Services, + &cli.StringSliceFlag{ + Name: "service", + Value: cli.NewStringSlice("gateway", "authregistry", "storageregistry"), // TODO appregistry + Usage: "--service gateway [--service authregistry]", + EnvVars: []string{"REVA_GATEWAY_SERVICES"}, }, // TODO should defaults to true. reverse logic to 'disable-share-commit'? &cli.BoolFlag{ Name: "commit-share-to-storage-grant", Usage: "Commit shares to the share manager as well as as a grant to the storage", - EnvVar: "REVA_GATEWAY_COMMIT_SHARE_TO_STRORAGE_GRANT", + EnvVars: []string{"REVA_GATEWAY_COMMIT_SHARE_TO_STRORAGE_GRANT"}, Destination: &cfg.Reva.Gateway.CommitShareToStorageGrant, }, @@ -153,35 +152,35 @@ func GatewayWithConfig(cfg *config.Config) []cli.Flag { Name: "frontend-url", Value: "localhost:9140", Usage: "URL to use for the reva service", - EnvVar: "REVA_FRONTEND_URL", + EnvVars: []string{"REVA_FRONTEND_URL"}, Destination: &cfg.Reva.Frontend.URL, }, &cli.StringFlag{ Name: "users-url", Value: "localhost:9144", Usage: "URL to use for the reva service", - EnvVar: "REVA_USERS_URL", + EnvVars: []string{"REVA_USERS_URL"}, Destination: &cfg.Reva.Users.URL, }, &cli.StringFlag{ Name: "auth-basic-url", Value: "localhost:9146", Usage: "URL to use for the reva service", - EnvVar: "REVA_AUTH_BASIC_URL", + EnvVars: []string{"REVA_AUTH_BASIC_URL"}, Destination: &cfg.Reva.AuthBasic.URL, }, &cli.StringFlag{ Name: "auth-bearer-url", Value: "localhost:9148", Usage: "URL to use for the reva service", - EnvVar: "REVA_AUTH_BEARER_URL", + EnvVars: []string{"REVA_AUTH_BEARER_URL"}, Destination: &cfg.Reva.AuthBearer.URL, }, &cli.StringFlag{ Name: "sharing-url", Value: "localhost:9150", Usage: "URL to use for the reva service", - EnvVar: "REVA_SHARING_URL", + EnvVars: []string{"REVA_SHARING_URL"}, Destination: &cfg.Reva.Sharing.URL, }, @@ -189,21 +188,21 @@ func GatewayWithConfig(cfg *config.Config) []cli.Flag { Name: "storage-root-url", Value: "localhost:9152", Usage: "URL to use for the reva service", - EnvVar: "REVA_STORAGE_ROOT_URL", + EnvVars: []string{"REVA_STORAGE_ROOT_URL"}, Destination: &cfg.Reva.StorageRoot.URL, }, &cli.StringFlag{ Name: "storage-root-mount-path", Value: "/", Usage: "mount path", - EnvVar: "REVA_STORAGE_ROOT_MOUNT_PATH", + EnvVars: []string{"REVA_STORAGE_ROOT_MOUNT_PATH"}, Destination: &cfg.Reva.StorageRoot.MountPath, }, &cli.StringFlag{ Name: "storage-root-mount-id", Value: "123e4567-e89b-12d3-a456-426655440001", Usage: "mount id", - EnvVar: "REVA_STORAGE_ROOT_MOUNT_ID", + EnvVars: []string{"REVA_STORAGE_ROOT_MOUNT_ID"}, Destination: &cfg.Reva.StorageRoot.MountID, }, @@ -211,21 +210,21 @@ func GatewayWithConfig(cfg *config.Config) []cli.Flag { Name: "storage-home-url", Value: "localhost:9154", Usage: "URL to use for the reva service", - EnvVar: "REVA_STORAGE_HOME_URL", + EnvVars: []string{"REVA_STORAGE_HOME_URL"}, Destination: &cfg.Reva.StorageHome.URL, }, &cli.StringFlag{ Name: "storage-home-mount-path", Value: "/home", Usage: "mount path", - EnvVar: "REVA_STORAGE_HOME_MOUNT_PATH", + EnvVars: []string{"REVA_STORAGE_HOME_MOUNT_PATH"}, Destination: &cfg.Reva.StorageHome.MountPath, }, &cli.StringFlag{ Name: "storage-home-mount-id", Value: "123e4567-e89b-12d3-a456-426655440000", Usage: "mount id", - EnvVar: "REVA_STORAGE_HOME_MOUNT_ID", + EnvVars: []string{"REVA_STORAGE_HOME_MOUNT_ID"}, Destination: &cfg.Reva.StorageHome.MountID, }, @@ -233,7 +232,7 @@ func GatewayWithConfig(cfg *config.Config) []cli.Flag { Name: "storage-home-data-url", Value: "localhost:9156", Usage: "URL to use for the reva service", - EnvVar: "REVA_STORAGE_HOME_DATA_URL", + EnvVars: []string{"REVA_STORAGE_HOME_DATA_URL"}, Destination: &cfg.Reva.StorageHomeData.URL, }, @@ -241,21 +240,21 @@ func GatewayWithConfig(cfg *config.Config) []cli.Flag { Name: "storage-oc-url", Value: "localhost:9162", Usage: "URL to use for the reva service", - EnvVar: "REVA_STORAGE_OC_URL", + EnvVars: []string{"REVA_STORAGE_OC_URL"}, Destination: &cfg.Reva.StorageOC.URL, }, &cli.StringFlag{ Name: "storage-oc-mount-path", Value: "/oc", Usage: "mount path", - EnvVar: "REVA_STORAGE_OC_MOUNT_PATH", + EnvVars: []string{"REVA_STORAGE_OC_MOUNT_PATH"}, Destination: &cfg.Reva.StorageOC.MountPath, }, &cli.StringFlag{ Name: "storage-oc-mount-id", Value: "123e4567-e89b-12d3-a456-426655440000", Usage: "mount id", - EnvVar: "REVA_STORAGE_OC_MOUNT_ID", + EnvVars: []string{"REVA_STORAGE_OC_MOUNT_ID"}, Destination: &cfg.Reva.StorageOC.MountID, }, @@ -263,7 +262,7 @@ func GatewayWithConfig(cfg *config.Config) []cli.Flag { Name: "storage-oc-data-url", Value: "localhost:9164", Usage: "URL to use for the reva service", - EnvVar: "REVA_STORAGE_OC_DATA_URL", + EnvVars: []string{"REVA_STORAGE_OC_DATA_URL"}, Destination: &cfg.Reva.StorageOCData.URL, }, } diff --git a/pkg/flagset/health.go b/pkg/flagset/health.go index 3c536cf8a..145d9b3e7 100644 --- a/pkg/flagset/health.go +++ b/pkg/flagset/health.go @@ -1,7 +1,7 @@ package flagset import ( - "github.com/micro/cli" + "github.com/micro/cli/v2" "github.com/owncloud/ocis-reva/pkg/config" ) @@ -12,7 +12,7 @@ func HealthWithConfig(cfg *config.Config) []cli.Flag { Name: "debug-addr", Value: "0.0.0.0:9109", Usage: "Address to debug endpoint", - EnvVar: "REVA_DEBUG_ADDR", + EnvVars: []string{"REVA_DEBUG_ADDR"}, Destination: &cfg.Debug.Addr, }, } diff --git a/pkg/flagset/root.go b/pkg/flagset/root.go index d839a6836..85d6436f9 100644 --- a/pkg/flagset/root.go +++ b/pkg/flagset/root.go @@ -1,7 +1,7 @@ package flagset import ( - "github.com/micro/cli" + "github.com/micro/cli/v2" "github.com/owncloud/ocis-reva/pkg/config" ) @@ -12,26 +12,26 @@ func RootWithConfig(cfg *config.Config) []cli.Flag { Name: "config-file", Value: "", Usage: "Path to config file", - EnvVar: "REVA_CONFIG_FILE", + EnvVars: []string{"REVA_CONFIG_FILE"}, Destination: &cfg.File, }, &cli.StringFlag{ Name: "log-level", Value: "info", Usage: "Set logging level", - EnvVar: "REVA_LOG_LEVEL", + EnvVars: []string{"REVA_LOG_LEVEL"}, Destination: &cfg.Log.Level, }, - &cli.BoolTFlag{ + &cli.BoolFlag{ Name: "log-pretty", Usage: "Enable pretty logging", - EnvVar: "REVA_LOG_PRETTY", + EnvVars: []string{"REVA_LOG_PRETTY"}, Destination: &cfg.Log.Pretty, }, - &cli.BoolTFlag{ + &cli.BoolFlag{ Name: "log-color", Usage: "Enable colored logging", - EnvVar: "REVA_LOG_COLOR", + EnvVars: []string{"REVA_LOG_COLOR"}, Destination: &cfg.Log.Color, }, } diff --git a/pkg/flagset/sharing.go b/pkg/flagset/sharing.go index 4b6016a2d..97003f0b9 100644 --- a/pkg/flagset/sharing.go +++ b/pkg/flagset/sharing.go @@ -1,7 +1,7 @@ package flagset import ( - "github.com/micro/cli" + "github.com/micro/cli/v2" "github.com/owncloud/ocis-reva/pkg/config" ) @@ -12,35 +12,35 @@ func SharingWithConfig(cfg *config.Config) []cli.Flag { &cli.BoolFlag{ Name: "tracing-enabled", Usage: "Enable sending traces", - EnvVar: "REVA_TRACING_ENABLED", + EnvVars: []string{"REVA_TRACING_ENABLED"}, Destination: &cfg.Tracing.Enabled, }, &cli.StringFlag{ Name: "tracing-type", Value: "jaeger", Usage: "Tracing backend type", - EnvVar: "REVA_TRACING_TYPE", + EnvVars: []string{"REVA_TRACING_TYPE"}, Destination: &cfg.Tracing.Type, }, &cli.StringFlag{ Name: "tracing-endpoint", Value: "", Usage: "Endpoint for the agent", - EnvVar: "REVA_TRACING_ENDPOINT", + EnvVars: []string{"REVA_TRACING_ENDPOINT"}, Destination: &cfg.Tracing.Endpoint, }, &cli.StringFlag{ Name: "tracing-collector", Value: "", Usage: "Endpoint for the collector", - EnvVar: "REVA_TRACING_COLLECTOR", + EnvVars: []string{"REVA_TRACING_COLLECTOR"}, Destination: &cfg.Tracing.Collector, }, &cli.StringFlag{ Name: "tracing-service", Value: "reva", Usage: "Service name for tracing", - EnvVar: "REVA_TRACING_SERVICE", + EnvVars: []string{"REVA_TRACING_SERVICE"}, Destination: &cfg.Tracing.Service, }, @@ -49,26 +49,26 @@ func SharingWithConfig(cfg *config.Config) []cli.Flag { Name: "debug-addr", Value: "0.0.0.0:9151", Usage: "Address to bind debug server", - EnvVar: "REVA_SHARING_DEBUG_ADDR", + EnvVars: []string{"REVA_SHARING_DEBUG_ADDR"}, Destination: &cfg.Reva.Sharing.DebugAddr, }, &cli.StringFlag{ Name: "debug-token", Value: "", Usage: "Token to grant metrics access", - EnvVar: "REVA_DEBUG_TOKEN", + EnvVars: []string{"REVA_DEBUG_TOKEN"}, Destination: &cfg.Debug.Token, }, &cli.BoolFlag{ Name: "debug-pprof", Usage: "Enable pprof debugging", - EnvVar: "REVA_DEBUG_PPROF", + EnvVars: []string{"REVA_DEBUG_PPROF"}, Destination: &cfg.Debug.Pprof, }, &cli.BoolFlag{ Name: "debug-zpages", Usage: "Enable zpages debugging", - EnvVar: "REVA_DEBUG_ZPAGES", + EnvVars: []string{"REVA_DEBUG_ZPAGES"}, Destination: &cfg.Debug.Zpages, }, @@ -78,7 +78,7 @@ func SharingWithConfig(cfg *config.Config) []cli.Flag { Name: "jwt-secret", Value: "Pive-Fumkiu4", Usage: "Shared jwt secret for reva service communication", - EnvVar: "REVA_JWT_SECRET", + EnvVars: []string{"REVA_JWT_SECRET"}, Destination: &cfg.Reva.JWTSecret, }, @@ -90,36 +90,35 @@ func SharingWithConfig(cfg *config.Config) []cli.Flag { Name: "network", Value: "tcp", Usage: "Network to use for the reva service, can be 'tcp', 'udp' or 'unix'", - EnvVar: "REVA_SHARING_NETWORK", + EnvVars: []string{"REVA_SHARING_NETWORK"}, Destination: &cfg.Reva.Sharing.Network, }, &cli.StringFlag{ Name: "protocol", Value: "grpc", Usage: "protocol for reva service, can be 'http' or 'grpc'", - EnvVar: "REVA_SHARING_PROTOCOL", + EnvVars: []string{"REVA_SHARING_PROTOCOL"}, Destination: &cfg.Reva.Sharing.Protocol, }, &cli.StringFlag{ Name: "addr", Value: "0.0.0.0:9150", Usage: "Address to bind reva service", - EnvVar: "REVA_SHARING_ADDR", + EnvVars: []string{"REVA_SHARING_ADDR"}, Destination: &cfg.Reva.Sharing.Addr, }, &cli.StringFlag{ Name: "url", Value: "localhost:9150", Usage: "URL to use for the reva service", - EnvVar: "REVA_SHARING_URL", + EnvVars: []string{"REVA_SHARING_URL"}, Destination: &cfg.Reva.Sharing.URL, }, - &cli.StringFlag{ - Name: "services", - Value: "usershareprovider,publicshareprovider", // TODO osmshareprovider - Usage: "comma separated list of services to include", - EnvVar: "REVA_SHARING_SERVICES", - Destination: &cfg.Reva.Sharing.Services, + &cli.StringSliceFlag{ + Name: "service", + Value: cli.NewStringSlice("usershareprovider", "publicshareprovider"), // TODO osmshareprovider + Usage: "--service usershareprovider [--service publicshareprovider]", + EnvVars: []string{"REVA_SHARING_SERVICES"}, }, } } diff --git a/pkg/flagset/storagehome.go b/pkg/flagset/storagehome.go index 8ade136f9..29cf19bb2 100644 --- a/pkg/flagset/storagehome.go +++ b/pkg/flagset/storagehome.go @@ -3,7 +3,7 @@ package flagset import ( "os" - "github.com/micro/cli" + "github.com/micro/cli/v2" "github.com/owncloud/ocis-reva/pkg/config" ) @@ -14,35 +14,35 @@ func StorageHomeWithConfig(cfg *config.Config) []cli.Flag { &cli.BoolFlag{ Name: "tracing-enabled", Usage: "Enable sending traces", - EnvVar: "REVA_TRACING_ENABLED", + EnvVars: []string{"REVA_TRACING_ENABLED"}, Destination: &cfg.Tracing.Enabled, }, &cli.StringFlag{ Name: "tracing-type", Value: "jaeger", Usage: "Tracing backend type", - EnvVar: "REVA_TRACING_TYPE", + EnvVars: []string{"REVA_TRACING_TYPE"}, Destination: &cfg.Tracing.Type, }, &cli.StringFlag{ Name: "tracing-endpoint", Value: "", Usage: "Endpoint for the agent", - EnvVar: "REVA_TRACING_ENDPOINT", + EnvVars: []string{"REVA_TRACING_ENDPOINT"}, Destination: &cfg.Tracing.Endpoint, }, &cli.StringFlag{ Name: "tracing-collector", Value: "", Usage: "Endpoint for the collector", - EnvVar: "REVA_TRACING_COLLECTOR", + EnvVars: []string{"REVA_TRACING_COLLECTOR"}, Destination: &cfg.Tracing.Collector, }, &cli.StringFlag{ Name: "tracing-service", Value: "reva", Usage: "Service name for tracing", - EnvVar: "REVA_TRACING_SERVICE", + EnvVars: []string{"REVA_TRACING_SERVICE"}, Destination: &cfg.Tracing.Service, }, @@ -51,26 +51,26 @@ func StorageHomeWithConfig(cfg *config.Config) []cli.Flag { Name: "debug-addr", Value: "0.0.0.0:9155", Usage: "Address to bind debug server", - EnvVar: "REVA_STORAGE_HOME_DEBUG_ADDR", + EnvVars: []string{"REVA_STORAGE_HOME_DEBUG_ADDR"}, Destination: &cfg.Reva.StorageHome.DebugAddr, }, &cli.StringFlag{ Name: "debug-token", Value: "", Usage: "Token to grant metrics access", - EnvVar: "REVA_DEBUG_TOKEN", + EnvVars: []string{"REVA_DEBUG_TOKEN"}, Destination: &cfg.Debug.Token, }, &cli.BoolFlag{ Name: "debug-pprof", Usage: "Enable pprof debugging", - EnvVar: "REVA_DEBUG_PPROF", + EnvVars: []string{"REVA_DEBUG_PPROF"}, Destination: &cfg.Debug.Pprof, }, &cli.BoolFlag{ Name: "debug-zpages", Usage: "Enable zpages debugging", - EnvVar: "REVA_DEBUG_ZPAGES", + EnvVars: []string{"REVA_DEBUG_ZPAGES"}, Destination: &cfg.Debug.Zpages, }, @@ -80,7 +80,7 @@ func StorageHomeWithConfig(cfg *config.Config) []cli.Flag { Name: "jwt-secret", Value: "Pive-Fumkiu4", Usage: "Shared jwt secret for reva service communication", - EnvVar: "REVA_JWT_SECRET", + EnvVars: []string{"REVA_JWT_SECRET"}, Destination: &cfg.Reva.JWTSecret, }, @@ -92,84 +92,83 @@ func StorageHomeWithConfig(cfg *config.Config) []cli.Flag { Name: "network", Value: "tcp", Usage: "Network to use for the reva service, can be 'tcp', 'udp' or 'unix'", - EnvVar: "REVA_STORAGE_HOME_NETWORK", + EnvVars: []string{"REVA_STORAGE_HOME_NETWORK"}, Destination: &cfg.Reva.StorageHome.Network, }, &cli.StringFlag{ Name: "protocol", Value: "grpc", Usage: "protocol for reva service, can be 'http' or 'grpc'", - EnvVar: "REVA_STORAGE_HOME_PROTOCOL", + EnvVars: []string{"REVA_STORAGE_HOME_PROTOCOL"}, Destination: &cfg.Reva.StorageHome.Protocol, }, &cli.StringFlag{ Name: "addr", Value: "0.0.0.0:9154", Usage: "Address to bind reva service", - EnvVar: "REVA_STORAGE_HOME_ADDR", + EnvVars: []string{"REVA_STORAGE_HOME_ADDR"}, Destination: &cfg.Reva.StorageHome.Addr, }, &cli.StringFlag{ Name: "url", Value: "localhost:9154", Usage: "URL to use for the reva service", - EnvVar: "REVA_STORAGE_HOME_URL", + EnvVars: []string{"REVA_STORAGE_HOME_URL"}, Destination: &cfg.Reva.StorageHome.URL, }, - &cli.StringFlag{ - Name: "services", - Value: "storageprovider", - Usage: "comma separated list of services to include", - EnvVar: "REVA_STORAGE_HOME_SERVICES", - Destination: &cfg.Reva.StorageHome.Services, + &cli.StringSliceFlag{ + Name: "service", + Value: cli.NewStringSlice("storageprovider"), + Usage: "--service storageprovider [--service otherservice]", + EnvVars: []string{"REVA_STORAGE_HOME_SERVICES"}, }, &cli.StringFlag{ Name: "driver", Value: "owncloud", Usage: "storage driver, eg. local, eos, owncloud or s3", - EnvVar: "REVA_STORAGE_HOME_DRIVER", + EnvVars: []string{"REVA_STORAGE_HOME_DRIVER"}, Destination: &cfg.Reva.StorageHome.Driver, }, &cli.StringFlag{ Name: "path-wrapper", Value: "context", Usage: "path wrapper", - EnvVar: "REVA_STORAGE_HOME_PATH_WRAPPER", + EnvVars: []string{"REVA_STORAGE_HOME_PATH_WRAPPER"}, Destination: &cfg.Reva.StorageHome.PathWrapper, }, &cli.StringFlag{ Name: "path-wrapper-context-prefix", Value: "", Usage: "path wrapper context prefix", - EnvVar: "REVA_STORAGE_HOME_PATH_WRAPPER_CONTEXT_PREFIX", + EnvVars: []string{"REVA_STORAGE_HOME_PATH_WRAPPER_CONTEXT_PREFIX"}, Destination: &cfg.Reva.StorageHome.PathWrapperContext.Prefix, }, &cli.StringFlag{ Name: "mount-path", Value: "/home", Usage: "mount path", - EnvVar: "REVA_STORAGE_HOME_MOUNT_PATH", + EnvVars: []string{"REVA_STORAGE_HOME_MOUNT_PATH"}, Destination: &cfg.Reva.StorageHome.MountPath, }, &cli.StringFlag{ Name: "mount-id", Value: "123e4567-e89b-12d3-a456-426655440000", Usage: "mount id", - EnvVar: "REVA_STORAGE_HOME_MOUNT_ID", + EnvVars: []string{"REVA_STORAGE_HOME_MOUNT_ID"}, Destination: &cfg.Reva.StorageHome.MountID, }, &cli.BoolFlag{ Name: "expose-data-server", Usage: "exposes a dedicated data server", - EnvVar: "REVA_STORAGE_HOME_EXPOSE_DATA_SERVER", + EnvVars: []string{"REVA_STORAGE_HOME_EXPOSE_DATA_SERVER"}, Destination: &cfg.Reva.StorageHome.ExposeDataServer, }, &cli.StringFlag{ Name: "data-server-url", Value: "http://localhost:9156/data", Usage: "data server url", - EnvVar: "REVA_STORAGE_HOME_DATA_SERVER_URL", + EnvVars: []string{"REVA_STORAGE_HOME_DATA_SERVER_URL"}, Destination: &cfg.Reva.StorageHome.DataServerURL, }, @@ -181,87 +180,87 @@ func StorageHomeWithConfig(cfg *config.Config) []cli.Flag { Name: "storage-eos-namespace", Value: "", Usage: "Namespace for metadata operations", - EnvVar: "REVA_STORAGE_EOS_NAMESPACE", + EnvVars: []string{"REVA_STORAGE_EOS_NAMESPACE"}, Destination: &cfg.Reva.Storages.EOS.Namespace, }, &cli.StringFlag{ Name: "storage-eos-binary", Value: "/usr/bin/eos", Usage: "Location of the eos binary", - EnvVar: "REVA_STORAGE_EOS_BINARY", + EnvVars: []string{"REVA_STORAGE_EOS_BINARY"}, Destination: &cfg.Reva.Storages.EOS.EosBinary, }, &cli.StringFlag{ Name: "storage-eos-xrdcopy-binary", Value: "/usr/bin/xrdcopy", Usage: "Location of the xrdcopy binary", - EnvVar: "REVA_STORAGE_EOS_XRDCOPY_BINARY", + EnvVars: []string{"REVA_STORAGE_EOS_XRDCOPY_BINARY"}, Destination: &cfg.Reva.Storages.EOS.XrdcopyBinary, }, &cli.StringFlag{ Name: "storage-eos-master-url", Value: "root://eos-example.org", Usage: "URL of the Master EOS MGM", - EnvVar: "REVA_STORAGE_EOS_MASTER_URL", + EnvVars: []string{"REVA_STORAGE_EOS_MASTER_URL"}, Destination: &cfg.Reva.Storages.EOS.MasterURL, }, &cli.StringFlag{ Name: "storage-eos-slave-url", Value: "root://eos-example.org", Usage: "URL of the Slave EOS MGM", - EnvVar: "REVA_STORAGE_EOS_SLAVE_URL", + EnvVars: []string{"REVA_STORAGE_EOS_SLAVE_URL"}, Destination: &cfg.Reva.Storages.EOS.SlaveURL, }, &cli.StringFlag{ Name: "storage-eos-cache-directory", Value: os.TempDir(), Usage: "Location on the local fs where to store reads", - EnvVar: "REVA_STORAGE_EOS_CACHE_DIRECTORY", + EnvVars: []string{"REVA_STORAGE_EOS_CACHE_DIRECTORY"}, Destination: &cfg.Reva.Storages.EOS.CacheDirectory, }, &cli.BoolFlag{ Name: "storage-eos-enable-logging", Usage: "Enables logging of the commands executed", - EnvVar: "REVA_STORAGE_EOS_ENABLE_LOGGING", + EnvVars: []string{"REVA_STORAGE_EOS_ENABLE_LOGGING"}, Destination: &cfg.Reva.Storages.EOS.EnableLogging, }, &cli.BoolFlag{ Name: "storage-eos-show-hidden-sysfiles", Usage: "show internal EOS files like .sys.v# and .sys.a# files.", - EnvVar: "REVA_STORAGE_EOS_SHOW_HIDDEN_SYSFILES", + EnvVars: []string{"REVA_STORAGE_EOS_SHOW_HIDDEN_SYSFILES"}, Destination: &cfg.Reva.Storages.EOS.ShowHiddenSysFiles, }, &cli.BoolFlag{ Name: "storage-eos-force-singleuser-mode", Usage: "force connections to EOS to use SingleUsername", - EnvVar: "REVA_STORAGE_EOS_FORCE_SINGLEUSER_MODE", + EnvVars: []string{"REVA_STORAGE_EOS_FORCE_SINGLEUSER_MODE"}, Destination: &cfg.Reva.Storages.EOS.ForceSingleUserMode, }, &cli.BoolFlag{ Name: "storage-eos-use-keytab", Usage: "authenticate requests by using an EOS keytab", - EnvVar: "REVA_STORAGE_EOS_USE_KEYTAB", + EnvVars: []string{"REVA_STORAGE_EOS_USE_KEYTAB"}, Destination: &cfg.Reva.Storages.EOS.UseKeytab, }, &cli.StringFlag{ Name: "storage-eos-sec-protocol", Value: "", Usage: "the xrootd security protocol to use between the server and EOS", - EnvVar: "REVA_STORAGE_EOS_SEC_PROTOCOL", + EnvVars: []string{"REVA_STORAGE_EOS_SEC_PROTOCOL"}, Destination: &cfg.Reva.Storages.EOS.SecProtocol, }, &cli.StringFlag{ Name: "storage-eos-keytab", Value: "", Usage: "the location of the keytab to use to authenticate to EOS", - EnvVar: "REVA_STORAGE_EOS_KEYTAB", + EnvVars: []string{"REVA_STORAGE_EOS_KEYTAB"}, Destination: &cfg.Reva.Storages.EOS.Keytab, }, &cli.StringFlag{ Name: "storage-eos-single-username", Value: "", Usage: "the username to use when SingleUserMode is enabled", - EnvVar: "REVA_STORAGE_EOS_SINGLE_USERNAME", + EnvVars: []string{"REVA_STORAGE_EOS_SINGLE_USERNAME"}, Destination: &cfg.Reva.Storages.EOS.SingleUsername, }, @@ -271,7 +270,7 @@ func StorageHomeWithConfig(cfg *config.Config) []cli.Flag { Name: "storage-local-root", Value: "/var/tmp/reva/root", Usage: "the path to the local storage root", - EnvVar: "REVA_STORAGE_LOCAL_ROOT", + EnvVars: []string{"REVA_STORAGE_LOCAL_ROOT"}, Destination: &cfg.Reva.Storages.Local.Root, }, @@ -281,7 +280,7 @@ func StorageHomeWithConfig(cfg *config.Config) []cli.Flag { Name: "storage-owncloud-datadir", Value: "/var/tmp/reva/data", Usage: "the path to the owncloud data directory", - EnvVar: "REVA_STORAGE_OWNCLOUD_DATADIR", + EnvVars: []string{"REVA_STORAGE_OWNCLOUD_DATADIR"}, Destination: &cfg.Reva.Storages.OwnCloud.Datadirectory, }, } diff --git a/pkg/flagset/storagehomedata.go b/pkg/flagset/storagehomedata.go index 569f428be..1d4d26e2f 100644 --- a/pkg/flagset/storagehomedata.go +++ b/pkg/flagset/storagehomedata.go @@ -3,7 +3,7 @@ package flagset import ( "os" - "github.com/micro/cli" + "github.com/micro/cli/v2" "github.com/owncloud/ocis-reva/pkg/config" ) @@ -14,35 +14,35 @@ func StorageHomeDataWithConfig(cfg *config.Config) []cli.Flag { &cli.BoolFlag{ Name: "tracing-enabled", Usage: "Enable sending traces", - EnvVar: "REVA_TRACING_ENABLED", + EnvVars: []string{"REVA_TRACING_ENABLED"}, Destination: &cfg.Tracing.Enabled, }, &cli.StringFlag{ Name: "tracing-type", Value: "jaeger", Usage: "Tracing backend type", - EnvVar: "REVA_TRACING_TYPE", + EnvVars: []string{"REVA_TRACING_TYPE"}, Destination: &cfg.Tracing.Type, }, &cli.StringFlag{ Name: "tracing-endpoint", Value: "", Usage: "Endpoint for the agent", - EnvVar: "REVA_TRACING_ENDPOINT", + EnvVars: []string{"REVA_TRACING_ENDPOINT"}, Destination: &cfg.Tracing.Endpoint, }, &cli.StringFlag{ Name: "tracing-collector", Value: "", Usage: "Endpoint for the collector", - EnvVar: "REVA_TRACING_COLLECTOR", + EnvVars: []string{"REVA_TRACING_COLLECTOR"}, Destination: &cfg.Tracing.Collector, }, &cli.StringFlag{ Name: "tracing-service", Value: "reva", Usage: "Service name for tracing", - EnvVar: "REVA_TRACING_SERVICE", + EnvVars: []string{"REVA_TRACING_SERVICE"}, Destination: &cfg.Tracing.Service, }, @@ -51,26 +51,26 @@ func StorageHomeDataWithConfig(cfg *config.Config) []cli.Flag { Name: "debug-addr", Value: "0.0.0.0:9157", Usage: "Address to bind debug server", - EnvVar: "REVA_STORAGE_HOME_DATA_DEBUG_ADDR", + EnvVars: []string{"REVA_STORAGE_HOME_DATA_DEBUG_ADDR"}, Destination: &cfg.Reva.StorageHomeData.DebugAddr, }, &cli.StringFlag{ Name: "debug-token", Value: "", Usage: "Token to grant metrics access", - EnvVar: "REVA_DEBUG_TOKEN", + EnvVars: []string{"REVA_DEBUG_TOKEN"}, Destination: &cfg.Debug.Token, }, &cli.BoolFlag{ Name: "debug-pprof", Usage: "Enable pprof debugging", - EnvVar: "REVA_DEBUG_PPROF", + EnvVars: []string{"REVA_DEBUG_PPROF"}, Destination: &cfg.Debug.Pprof, }, &cli.BoolFlag{ Name: "debug-zpages", Usage: "Enable zpages debugging", - EnvVar: "REVA_DEBUG_ZPAGES", + EnvVars: []string{"REVA_DEBUG_ZPAGES"}, Destination: &cfg.Debug.Zpages, }, @@ -80,7 +80,7 @@ func StorageHomeDataWithConfig(cfg *config.Config) []cli.Flag { Name: "jwt-secret", Value: "Pive-Fumkiu4", Usage: "Shared jwt secret for reva service communication", - EnvVar: "REVA_JWT_SECRET", + EnvVars: []string{"REVA_JWT_SECRET"}, Destination: &cfg.Reva.JWTSecret, }, @@ -92,56 +92,55 @@ func StorageHomeDataWithConfig(cfg *config.Config) []cli.Flag { Name: "network", Value: "tcp", Usage: "Network to use for the reva service, can be 'tcp', 'udp' or 'unix'", - EnvVar: "REVA_STORAGE_HOME_DATA_NETWORK", + EnvVars: []string{"REVA_STORAGE_HOME_DATA_NETWORK"}, Destination: &cfg.Reva.StorageHomeData.Network, }, &cli.StringFlag{ Name: "protocol", Value: "http", Usage: "protocol for reva service, can be 'http' or 'grpc'", - EnvVar: "REVA_STORAGE_HOME_DATA_PROTOCOL", + EnvVars: []string{"REVA_STORAGE_HOME_DATA_PROTOCOL"}, Destination: &cfg.Reva.StorageHomeData.Protocol, }, &cli.StringFlag{ Name: "addr", Value: "0.0.0.0:9156", Usage: "Address to bind reva service", - EnvVar: "REVA_STORAGE_HOME_DATA_ADDR", + EnvVars: []string{"REVA_STORAGE_HOME_DATA_ADDR"}, Destination: &cfg.Reva.StorageHomeData.Addr, }, &cli.StringFlag{ Name: "url", Value: "localhost:9156", Usage: "URL to use for the reva service", - EnvVar: "REVA_STORAGE_HOME_DATA_URL", + EnvVars: []string{"REVA_STORAGE_HOME_DATA_URL"}, Destination: &cfg.Reva.StorageHomeData.URL, }, - &cli.StringFlag{ - Name: "services", - Value: "dataprovider", - Usage: "comma separated list of services to include", - EnvVar: "REVA_STORAGE_HOME_DATA_SERVICES", - Destination: &cfg.Reva.StorageHomeData.Services, + &cli.StringSliceFlag{ + Name: "service", + Value: cli.NewStringSlice("dataprovider"), + Usage: "--service dataprovider [--service otherservice]", + EnvVars: []string{"REVA_STORAGE_HOME_DATA_SERVICES"}, }, &cli.StringFlag{ Name: "driver", Value: "owncloud", Usage: "storage driver, eg. local, eos, owncloud or s3", - EnvVar: "REVA_STORAGE_HOME_DATA_DRIVER", + EnvVars: []string{"REVA_STORAGE_HOME_DATA_DRIVER"}, Destination: &cfg.Reva.StorageHomeData.Driver, }, &cli.StringFlag{ Name: "prefix", Value: "data", Usage: "prefix for the http endpoint, without leading slash", - EnvVar: "REVA_STORAGE_HOME_DATA_PREFIX", + EnvVars: []string{"REVA_STORAGE_HOME_DATA_PREFIX"}, Destination: &cfg.Reva.StorageHomeData.Prefix, }, &cli.StringFlag{ Name: "temp-folder", Value: "/var/tmp/", Usage: "temp folder", - EnvVar: "REVA_STORAGE_HOME_DATA_TEMP_FOLDER", + EnvVars: []string{"REVA_STORAGE_HOME_DATA_TEMP_FOLDER"}, Destination: &cfg.Reva.StorageHomeData.TempFolder, }, @@ -153,87 +152,87 @@ func StorageHomeDataWithConfig(cfg *config.Config) []cli.Flag { Name: "storage-eos-namespace", Value: "", Usage: "Namespace for metadata operations", - EnvVar: "REVA_STORAGE_EOS_NAMESPACE", + EnvVars: []string{"REVA_STORAGE_EOS_NAMESPACE"}, Destination: &cfg.Reva.Storages.EOS.Namespace, }, &cli.StringFlag{ Name: "storage-eos-binary", Value: "/usr/bin/eos", Usage: "Location of the eos binary", - EnvVar: "REVA_STORAGE_EOS_BINARY", + EnvVars: []string{"REVA_STORAGE_EOS_BINARY"}, Destination: &cfg.Reva.Storages.EOS.EosBinary, }, &cli.StringFlag{ Name: "storage-eos-xrdcopy-binary", Value: "/usr/bin/xrdcopy", Usage: "Location of the xrdcopy binary", - EnvVar: "REVA_STORAGE_EOS_XRDCOPY_BINARY", + EnvVars: []string{"REVA_STORAGE_EOS_XRDCOPY_BINARY"}, Destination: &cfg.Reva.Storages.EOS.XrdcopyBinary, }, &cli.StringFlag{ Name: "storage-eos-master-url", Value: "root://eos-example.org", Usage: "URL of the Master EOS MGM", - EnvVar: "REVA_STORAGE_EOS_MASTER_URL", + EnvVars: []string{"REVA_STORAGE_EOS_MASTER_URL"}, Destination: &cfg.Reva.Storages.EOS.MasterURL, }, &cli.StringFlag{ Name: "storage-eos-slave-url", Value: "root://eos-example.org", Usage: "URL of the Slave EOS MGM", - EnvVar: "REVA_STORAGE_EOS_SLAVE_URL", + EnvVars: []string{"REVA_STORAGE_EOS_SLAVE_URL"}, Destination: &cfg.Reva.Storages.EOS.SlaveURL, }, &cli.StringFlag{ Name: "storage-eos-cache-directory", Value: os.TempDir(), Usage: "Location on the local fs where to store reads", - EnvVar: "REVA_STORAGE_EOS_CACHE_DIRECTORY", + EnvVars: []string{"REVA_STORAGE_EOS_CACHE_DIRECTORY"}, Destination: &cfg.Reva.Storages.EOS.CacheDirectory, }, &cli.BoolFlag{ Name: "storage-eos-enable-logging", Usage: "Enables logging of the commands executed", - EnvVar: "REVA_STORAGE_EOS_ENABLE_LOGGING", + EnvVars: []string{"REVA_STORAGE_EOS_ENABLE_LOGGING"}, Destination: &cfg.Reva.Storages.EOS.EnableLogging, }, &cli.BoolFlag{ Name: "storage-eos-show-hidden-sysfiles", Usage: "show internal EOS files like .sys.v# and .sys.a# files.", - EnvVar: "REVA_STORAGE_EOS_SHOW_HIDDEN_SYSFILES", + EnvVars: []string{"REVA_STORAGE_EOS_SHOW_HIDDEN_SYSFILES"}, Destination: &cfg.Reva.Storages.EOS.ShowHiddenSysFiles, }, &cli.BoolFlag{ Name: "storage-eos-force-singleuser-mode", Usage: "force connections to EOS to use SingleUsername", - EnvVar: "REVA_STORAGE_EOS_FORCE_SINGLEUSER_MODE", + EnvVars: []string{"REVA_STORAGE_EOS_FORCE_SINGLEUSER_MODE"}, Destination: &cfg.Reva.Storages.EOS.ForceSingleUserMode, }, &cli.BoolFlag{ Name: "storage-eos-use-keytab", Usage: "authenticate requests by using an EOS keytab", - EnvVar: "REVA_STORAGE_EOS_USE_KEYTAB", + EnvVars: []string{"REVA_STORAGE_EOS_USE_KEYTAB"}, Destination: &cfg.Reva.Storages.EOS.UseKeytab, }, &cli.StringFlag{ Name: "storage-eos-sec-protocol", Value: "", Usage: "the xrootd security protocol to use between the server and EOS", - EnvVar: "REVA_STORAGE_EOS_SEC_PROTOCOL", + EnvVars: []string{"REVA_STORAGE_EOS_SEC_PROTOCOL"}, Destination: &cfg.Reva.Storages.EOS.SecProtocol, }, &cli.StringFlag{ Name: "storage-eos-keytab", Value: "", Usage: "the location of the keytab to use to authenticate to EOS", - EnvVar: "REVA_STORAGE_EOS_KEYTAB", + EnvVars: []string{"REVA_STORAGE_EOS_KEYTAB"}, Destination: &cfg.Reva.Storages.EOS.Keytab, }, &cli.StringFlag{ Name: "storage-eos-single-username", Value: "", Usage: "the username to use when SingleUserMode is enabled", - EnvVar: "REVA_STORAGE_EOS_SINGLE_USERNAME", + EnvVars: []string{"REVA_STORAGE_EOS_SINGLE_USERNAME"}, Destination: &cfg.Reva.Storages.EOS.SingleUsername, }, @@ -243,7 +242,7 @@ func StorageHomeDataWithConfig(cfg *config.Config) []cli.Flag { Name: "storage-local-root", Value: "/var/tmp/reva/root", Usage: "the path to the local storage root", - EnvVar: "REVA_STORAGE_LOCAL_ROOT", + EnvVars: []string{"REVA_STORAGE_LOCAL_ROOT"}, Destination: &cfg.Reva.Storages.Local.Root, }, @@ -253,7 +252,7 @@ func StorageHomeDataWithConfig(cfg *config.Config) []cli.Flag { Name: "storage-owncloud-datadir", Value: "/var/tmp/reva/data", Usage: "the path to the owncloud data directory", - EnvVar: "REVA_STORAGE_OWNCLOUD_DATADIR", + EnvVars: []string{"REVA_STORAGE_OWNCLOUD_DATADIR"}, Destination: &cfg.Reva.Storages.OwnCloud.Datadirectory, }, @@ -263,7 +262,7 @@ func StorageHomeDataWithConfig(cfg *config.Config) []cli.Flag { Name: "gateway-url", Value: "localhost:9142", Usage: "URL to use for the reva gateway service", - EnvVar: "REVA_GATEWAY_URL", + EnvVars: []string{"REVA_GATEWAY_URL"}, Destination: &cfg.Reva.Gateway.URL, }, } diff --git a/pkg/flagset/storageoc.go b/pkg/flagset/storageoc.go index 2bf4303db..5e587cf00 100644 --- a/pkg/flagset/storageoc.go +++ b/pkg/flagset/storageoc.go @@ -3,7 +3,7 @@ package flagset import ( "os" - "github.com/micro/cli" + "github.com/micro/cli/v2" "github.com/owncloud/ocis-reva/pkg/config" ) @@ -14,35 +14,35 @@ func StorageOCWithConfig(cfg *config.Config) []cli.Flag { &cli.BoolFlag{ Name: "tracing-enabled", Usage: "Enable sending traces", - EnvVar: "REVA_TRACING_ENABLED", + EnvVars: []string{"REVA_TRACING_ENABLED"}, Destination: &cfg.Tracing.Enabled, }, &cli.StringFlag{ Name: "tracing-type", Value: "jaeger", Usage: "Tracing backend type", - EnvVar: "REVA_TRACING_TYPE", + EnvVars: []string{"REVA_TRACING_TYPE"}, Destination: &cfg.Tracing.Type, }, &cli.StringFlag{ Name: "tracing-endpoint", Value: "", Usage: "Endpoint for the agent", - EnvVar: "REVA_TRACING_ENDPOINT", + EnvVars: []string{"REVA_TRACING_ENDPOINT"}, Destination: &cfg.Tracing.Endpoint, }, &cli.StringFlag{ Name: "tracing-collector", Value: "", Usage: "Endpoint for the collector", - EnvVar: "REVA_TRACING_COLLECTOR", + EnvVars: []string{"REVA_TRACING_COLLECTOR"}, Destination: &cfg.Tracing.Collector, }, &cli.StringFlag{ Name: "tracing-service", Value: "reva", Usage: "Service name for tracing", - EnvVar: "REVA_TRACING_SERVICE", + EnvVars: []string{"REVA_TRACING_SERVICE"}, Destination: &cfg.Tracing.Service, }, @@ -51,26 +51,26 @@ func StorageOCWithConfig(cfg *config.Config) []cli.Flag { Name: "debug-addr", Value: "0.0.0.0:9163", Usage: "Address to bind debug server", - EnvVar: "REVA_STORAGE_OC_DEBUG_ADDR", + EnvVars: []string{"REVA_STORAGE_OC_DEBUG_ADDR"}, Destination: &cfg.Reva.StorageOC.DebugAddr, }, &cli.StringFlag{ Name: "debug-token", Value: "", Usage: "Token to grant metrics access", - EnvVar: "REVA_DEBUG_TOKEN", + EnvVars: []string{"REVA_DEBUG_TOKEN"}, Destination: &cfg.Debug.Token, }, &cli.BoolFlag{ Name: "debug-pprof", Usage: "Enable pprof debugging", - EnvVar: "REVA_DEBUG_PPROF", + EnvVars: []string{"REVA_DEBUG_PPROF"}, Destination: &cfg.Debug.Pprof, }, &cli.BoolFlag{ Name: "debug-zpages", Usage: "Enable zpages debugging", - EnvVar: "REVA_DEBUG_ZPAGES", + EnvVars: []string{"REVA_DEBUG_ZPAGES"}, Destination: &cfg.Debug.Zpages, }, @@ -80,7 +80,7 @@ func StorageOCWithConfig(cfg *config.Config) []cli.Flag { Name: "jwt-secret", Value: "Pive-Fumkiu4", Usage: "Shared jwt secret for reva service communication", - EnvVar: "REVA_JWT_SECRET", + EnvVars: []string{"REVA_JWT_SECRET"}, Destination: &cfg.Reva.JWTSecret, }, @@ -92,84 +92,83 @@ func StorageOCWithConfig(cfg *config.Config) []cli.Flag { Name: "network", Value: "tcp", Usage: "Network to use for the reva service, can be 'tcp', 'udp' or 'unix'", - EnvVar: "REVA_STORAGE_OC_NETWORK", + EnvVars: []string{"REVA_STORAGE_OC_NETWORK"}, Destination: &cfg.Reva.StorageOC.Network, }, &cli.StringFlag{ Name: "protocol", Value: "grpc", Usage: "protocol for reva service, can be 'http' or 'grpc'", - EnvVar: "REVA_STORAGE_OC_PROTOCOL", + EnvVars: []string{"REVA_STORAGE_OC_PROTOCOL"}, Destination: &cfg.Reva.StorageOC.Protocol, }, &cli.StringFlag{ Name: "addr", Value: "0.0.0.0:9162", Usage: "Address to bind reva service", - EnvVar: "REVA_STORAGE_OC_ADDR", + EnvVars: []string{"REVA_STORAGE_OC_ADDR"}, Destination: &cfg.Reva.StorageOC.Addr, }, &cli.StringFlag{ Name: "url", Value: "localhost:9162", Usage: "URL to use for the reva service", - EnvVar: "REVA_STORAGE_OC_URL", + EnvVars: []string{"REVA_STORAGE_OC_URL"}, Destination: &cfg.Reva.StorageOC.URL, }, - &cli.StringFlag{ - Name: "services", - Value: "storageprovider", - Usage: "comma separated list of services to include", - EnvVar: "REVA_STORAGE_OC_SERVICES", - Destination: &cfg.Reva.StorageOC.Services, + &cli.StringSliceFlag{ + Name: "service", + Value: cli.NewStringSlice("storageprovider"), + Usage: "--service storageprovider [--service otherservice]", + EnvVars: []string{"REVA_STORAGE_OC_SERVICES"}, }, &cli.StringFlag{ Name: "driver", Value: "owncloud", Usage: "storage driver, eg. local, eos, owncloud or s3", - EnvVar: "REVA_STORAGE_OC_DRIVER", + EnvVars: []string{"REVA_STORAGE_OC_DRIVER"}, Destination: &cfg.Reva.StorageOC.Driver, }, &cli.StringFlag{ Name: "path-wrapper", Value: "", Usage: "path wrapper", - EnvVar: "REVA_STORAGE_OC_PATH_WRAPPER", + EnvVars: []string{"REVA_STORAGE_OC_PATH_WRAPPER"}, Destination: &cfg.Reva.StorageOC.PathWrapper, }, &cli.StringFlag{ Name: "path-wrapper-context-prefix", Value: "", Usage: "path wrapper context prefix", - EnvVar: "REVA_STORAGE_OC_PATH_WRAPPER_CONTEXT_PREFIX", + EnvVars: []string{"REVA_STORAGE_OC_PATH_WRAPPER_CONTEXT_PREFIX"}, Destination: &cfg.Reva.StorageOC.PathWrapperContext.Prefix, }, &cli.StringFlag{ Name: "mount-path", Value: "/oc", Usage: "mount path", - EnvVar: "REVA_STORAGE_OC_MOUNT_PATH", + EnvVars: []string{"REVA_STORAGE_OC_MOUNT_PATH"}, Destination: &cfg.Reva.StorageOC.MountPath, }, &cli.StringFlag{ Name: "mount-id", Value: "123e4567-e89b-12d3-a456-426655440000", Usage: "mount id", - EnvVar: "REVA_STORAGE_OC_MOUNT_ID", + EnvVars: []string{"REVA_STORAGE_OC_MOUNT_ID"}, Destination: &cfg.Reva.StorageOC.MountID, }, &cli.BoolFlag{ Name: "expose-data-server", Usage: "exposes a dedicated data server", - EnvVar: "REVA_STORAGE_OC_EXPOSE_DATA_SERVER", + EnvVars: []string{"REVA_STORAGE_OC_EXPOSE_DATA_SERVER"}, Destination: &cfg.Reva.StorageOC.ExposeDataServer, }, &cli.StringFlag{ Name: "data-server-url", Value: "http://localhost:9164/data", Usage: "data server url", - EnvVar: "REVA_STORAGE_OC_DATA_SERVER_URL", + EnvVars: []string{"REVA_STORAGE_OC_DATA_SERVER_URL"}, Destination: &cfg.Reva.StorageOC.DataServerURL, }, @@ -181,87 +180,87 @@ func StorageOCWithConfig(cfg *config.Config) []cli.Flag { Name: "storage-eos-namespace", Value: "", Usage: "Namespace for metadata operations", - EnvVar: "REVA_STORAGE_EOS_NAMESPACE", + EnvVars: []string{"REVA_STORAGE_EOS_NAMESPACE"}, Destination: &cfg.Reva.Storages.EOS.Namespace, }, &cli.StringFlag{ Name: "storage-eos-binary", Value: "/usr/bin/eos", Usage: "Location of the eos binary", - EnvVar: "REVA_STORAGE_EOS_BINARY", + EnvVars: []string{"REVA_STORAGE_EOS_BINARY"}, Destination: &cfg.Reva.Storages.EOS.EosBinary, }, &cli.StringFlag{ Name: "storage-eos-xrdcopy-binary", Value: "/usr/bin/xrdcopy", Usage: "Location of the xrdcopy binary", - EnvVar: "REVA_STORAGE_EOS_XRDCOPY_BINARY", + EnvVars: []string{"REVA_STORAGE_EOS_XRDCOPY_BINARY"}, Destination: &cfg.Reva.Storages.EOS.XrdcopyBinary, }, &cli.StringFlag{ Name: "storage-eos-master-url", Value: "root://eos-example.org", Usage: "URL of the Master EOS MGM", - EnvVar: "REVA_STORAGE_EOS_MASTER_URL", + EnvVars: []string{"REVA_STORAGE_EOS_MASTER_URL"}, Destination: &cfg.Reva.Storages.EOS.MasterURL, }, &cli.StringFlag{ Name: "storage-eos-slave-url", Value: "root://eos-example.org", Usage: "URL of the Slave EOS MGM", - EnvVar: "REVA_STORAGE_EOS_SLAVE_URL", + EnvVars: []string{"REVA_STORAGE_EOS_SLAVE_URL"}, Destination: &cfg.Reva.Storages.EOS.SlaveURL, }, &cli.StringFlag{ Name: "storage-eos-cache-directory", Value: os.TempDir(), Usage: "Location on the local fs where to store reads", - EnvVar: "REVA_STORAGE_EOS_CACHE_DIRECTORY", + EnvVars: []string{"REVA_STORAGE_EOS_CACHE_DIRECTORY"}, Destination: &cfg.Reva.Storages.EOS.CacheDirectory, }, &cli.BoolFlag{ Name: "storage-eos-enable-logging", Usage: "Enables logging of the commands executed", - EnvVar: "REVA_STORAGE_EOS_ENABLE_LOGGING", + EnvVars: []string{"REVA_STORAGE_EOS_ENABLE_LOGGING"}, Destination: &cfg.Reva.Storages.EOS.EnableLogging, }, &cli.BoolFlag{ Name: "storage-eos-show-hidden-sysfiles", Usage: "show internal EOS files like .sys.v# and .sys.a# files.", - EnvVar: "REVA_STORAGE_EOS_SHOW_HIDDEN_SYSFILES", + EnvVars: []string{"REVA_STORAGE_EOS_SHOW_HIDDEN_SYSFILES"}, Destination: &cfg.Reva.Storages.EOS.ShowHiddenSysFiles, }, &cli.BoolFlag{ Name: "storage-eos-force-singleuser-mode", Usage: "force connections to EOS to use SingleUsername", - EnvVar: "REVA_STORAGE_EOS_FORCE_SINGLEUSER_MODE", + EnvVars: []string{"REVA_STORAGE_EOS_FORCE_SINGLEUSER_MODE"}, Destination: &cfg.Reva.Storages.EOS.ForceSingleUserMode, }, &cli.BoolFlag{ Name: "storage-eos-use-keytab", Usage: "authenticate requests by using an EOS keytab", - EnvVar: "REVA_STORAGE_EOS_USE_KEYTAB", + EnvVars: []string{"REVA_STORAGE_EOS_USE_KEYTAB"}, Destination: &cfg.Reva.Storages.EOS.UseKeytab, }, &cli.StringFlag{ Name: "storage-eos-sec-protocol", Value: "", Usage: "the xrootd security protocol to use between the server and EOS", - EnvVar: "REVA_STORAGE_EOS_SEC_PROTOCOL", + EnvVars: []string{"REVA_STORAGE_EOS_SEC_PROTOCOL"}, Destination: &cfg.Reva.Storages.EOS.SecProtocol, }, &cli.StringFlag{ Name: "storage-eos-keytab", Value: "", Usage: "the location of the keytab to use to authenticate to EOS", - EnvVar: "REVA_STORAGE_EOS_KEYTAB", + EnvVars: []string{"REVA_STORAGE_EOS_KEYTAB"}, Destination: &cfg.Reva.Storages.EOS.Keytab, }, &cli.StringFlag{ Name: "storage-eos-single-username", Value: "", Usage: "the username to use when SingleUserMode is enabled", - EnvVar: "REVA_STORAGE_EOS_SINGLE_USERNAME", + EnvVars: []string{"REVA_STORAGE_EOS_SINGLE_USERNAME"}, Destination: &cfg.Reva.Storages.EOS.SingleUsername, }, @@ -271,7 +270,7 @@ func StorageOCWithConfig(cfg *config.Config) []cli.Flag { Name: "storage-local-root", Value: "/var/tmp/reva/root", Usage: "the path to the local storage root", - EnvVar: "REVA_STORAGE_LOCAL_ROOT", + EnvVars: []string{"REVA_STORAGE_LOCAL_ROOT"}, Destination: &cfg.Reva.Storages.Local.Root, }, @@ -281,7 +280,7 @@ func StorageOCWithConfig(cfg *config.Config) []cli.Flag { Name: "storage-owncloud-datadir", Value: "/var/tmp/reva/data", Usage: "the path to the owncloud data directory", - EnvVar: "REVA_STORAGE_OWNCLOUD_DATADIR", + EnvVars: []string{"REVA_STORAGE_OWNCLOUD_DATADIR"}, Destination: &cfg.Reva.Storages.OwnCloud.Datadirectory, }, } diff --git a/pkg/flagset/storageocdata.go b/pkg/flagset/storageocdata.go index 8d0244d51..9d16511cf 100644 --- a/pkg/flagset/storageocdata.go +++ b/pkg/flagset/storageocdata.go @@ -3,7 +3,7 @@ package flagset import ( "os" - "github.com/micro/cli" + "github.com/micro/cli/v2" "github.com/owncloud/ocis-reva/pkg/config" ) @@ -14,35 +14,35 @@ func StorageOCDataWithConfig(cfg *config.Config) []cli.Flag { &cli.BoolFlag{ Name: "tracing-enabled", Usage: "Enable sending traces", - EnvVar: "REVA_TRACING_ENABLED", + EnvVars: []string{"REVA_TRACING_ENABLED"}, Destination: &cfg.Tracing.Enabled, }, &cli.StringFlag{ Name: "tracing-type", Value: "jaeger", Usage: "Tracing backend type", - EnvVar: "REVA_TRACING_TYPE", + EnvVars: []string{"REVA_TRACING_TYPE"}, Destination: &cfg.Tracing.Type, }, &cli.StringFlag{ Name: "tracing-endpoint", Value: "", Usage: "Endpoint for the agent", - EnvVar: "REVA_TRACING_ENDPOINT", + EnvVars: []string{"REVA_TRACING_ENDPOINT"}, Destination: &cfg.Tracing.Endpoint, }, &cli.StringFlag{ Name: "tracing-collector", Value: "", Usage: "Endpoint for the collector", - EnvVar: "REVA_TRACING_COLLECTOR", + EnvVars: []string{"REVA_TRACING_COLLECTOR"}, Destination: &cfg.Tracing.Collector, }, &cli.StringFlag{ Name: "tracing-service", Value: "reva", Usage: "Service name for tracing", - EnvVar: "REVA_TRACING_SERVICE", + EnvVars: []string{"REVA_TRACING_SERVICE"}, Destination: &cfg.Tracing.Service, }, @@ -51,26 +51,26 @@ func StorageOCDataWithConfig(cfg *config.Config) []cli.Flag { Name: "debug-addr", Value: "0.0.0.0:9165", Usage: "Address to bind debug server", - EnvVar: "REVA_STORAGE_OC_DATA_DEBUG_ADDR", + EnvVars: []string{"REVA_STORAGE_OC_DATA_DEBUG_ADDR"}, Destination: &cfg.Reva.StorageOCData.DebugAddr, }, &cli.StringFlag{ Name: "debug-token", Value: "", Usage: "Token to grant metrics access", - EnvVar: "REVA_DEBUG_TOKEN", + EnvVars: []string{"REVA_DEBUG_TOKEN"}, Destination: &cfg.Debug.Token, }, &cli.BoolFlag{ Name: "debug-pprof", Usage: "Enable pprof debugging", - EnvVar: "REVA_DEBUG_PPROF", + EnvVars: []string{"REVA_DEBUG_PPROF"}, Destination: &cfg.Debug.Pprof, }, &cli.BoolFlag{ Name: "debug-zpages", Usage: "Enable zpages debugging", - EnvVar: "REVA_DEBUG_ZPAGES", + EnvVars: []string{"REVA_DEBUG_ZPAGES"}, Destination: &cfg.Debug.Zpages, }, @@ -80,7 +80,7 @@ func StorageOCDataWithConfig(cfg *config.Config) []cli.Flag { Name: "jwt-secret", Value: "Pive-Fumkiu4", Usage: "Shared jwt secret for reva service communication", - EnvVar: "REVA_JWT_SECRET", + EnvVars: []string{"REVA_JWT_SECRET"}, Destination: &cfg.Reva.JWTSecret, }, @@ -92,56 +92,55 @@ func StorageOCDataWithConfig(cfg *config.Config) []cli.Flag { Name: "network", Value: "tcp", Usage: "Network to use for the reva service, can be 'tcp', 'udp' or 'unix'", - EnvVar: "REVA_STORAGE_OC_DATA_NETWORK", + EnvVars: []string{"REVA_STORAGE_OC_DATA_NETWORK"}, Destination: &cfg.Reva.StorageOCData.Network, }, &cli.StringFlag{ Name: "protocol", Value: "http", Usage: "protocol for reva service, can be 'http' or 'grpc'", - EnvVar: "REVA_STORAGE_OC_DATA_PROTOCOL", + EnvVars: []string{"REVA_STORAGE_OC_DATA_PROTOCOL"}, Destination: &cfg.Reva.StorageOCData.Protocol, }, &cli.StringFlag{ Name: "addr", Value: "0.0.0.0:9164", Usage: "Address to bind reva service", - EnvVar: "REVA_STORAGE_OC_DATA_ADDR", + EnvVars: []string{"REVA_STORAGE_OC_DATA_ADDR"}, Destination: &cfg.Reva.StorageOCData.Addr, }, &cli.StringFlag{ Name: "url", Value: "localhost:9164", Usage: "URL to use for the reva service", - EnvVar: "REVA_STORAGE_OC_DATA_URL", + EnvVars: []string{"REVA_STORAGE_OC_DATA_URL"}, Destination: &cfg.Reva.StorageOCData.URL, }, - &cli.StringFlag{ - Name: "services", - Value: "dataprovider", - Usage: "comma separated list of services to include in the storage-oc data service", - EnvVar: "REVA_STORAGE_OC_DATA_SERVICES", - Destination: &cfg.Reva.StorageOCData.Services, + &cli.StringSliceFlag{ + Name: "service", + Value: cli.NewStringSlice("dataprovider"), + Usage: "--service dataprovider [--service otherservice]", + EnvVars: []string{"REVA_STORAGE_OC_DATA_SERVICES"}, }, &cli.StringFlag{ Name: "driver", Value: "owncloud", Usage: "storage driver, eg. local, eos, owncloud or s3", - EnvVar: "REVA_STORAGE_OC_DATA_DRIVER", + EnvVars: []string{"REVA_STORAGE_OC_DATA_DRIVER"}, Destination: &cfg.Reva.StorageOCData.Driver, }, &cli.StringFlag{ Name: "prefix", Value: "data", Usage: "prefix for the http endpoint, without leading slash", - EnvVar: "REVA_STORAGE_OC_DATA_PREFIX", + EnvVars: []string{"REVA_STORAGE_OC_DATA_PREFIX"}, Destination: &cfg.Reva.StorageOCData.Prefix, }, &cli.StringFlag{ Name: "temp-folder", Value: "/var/tmp/", Usage: "temp folder", - EnvVar: "REVA_STORAGE_OC_DATA_TEMP_FOLDER", + EnvVars: []string{"REVA_STORAGE_OC_DATA_TEMP_FOLDER"}, Destination: &cfg.Reva.StorageOCData.TempFolder, }, @@ -153,87 +152,87 @@ func StorageOCDataWithConfig(cfg *config.Config) []cli.Flag { Name: "storage-eos-namespace", Value: "", Usage: "Namespace for metadata operations", - EnvVar: "REVA_STORAGE_EOS_NAMESPACE", + EnvVars: []string{"REVA_STORAGE_EOS_NAMESPACE"}, Destination: &cfg.Reva.Storages.EOS.Namespace, }, &cli.StringFlag{ Name: "storage-eos-binary", Value: "/usr/bin/eos", Usage: "Location of the eos binary", - EnvVar: "REVA_STORAGE_EOS_BINARY", + EnvVars: []string{"REVA_STORAGE_EOS_BINARY"}, Destination: &cfg.Reva.Storages.EOS.EosBinary, }, &cli.StringFlag{ Name: "storage-eos-xrdcopy-binary", Value: "/usr/bin/xrdcopy", Usage: "Location of the xrdcopy binary", - EnvVar: "REVA_STORAGE_EOS_XRDCOPY_BINARY", + EnvVars: []string{"REVA_STORAGE_EOS_XRDCOPY_BINARY"}, Destination: &cfg.Reva.Storages.EOS.XrdcopyBinary, }, &cli.StringFlag{ Name: "storage-eos-master-url", Value: "root://eos-example.org", Usage: "URL of the Master EOS MGM", - EnvVar: "REVA_STORAGE_EOS_MASTER_URL", + EnvVars: []string{"REVA_STORAGE_EOS_MASTER_URL"}, Destination: &cfg.Reva.Storages.EOS.MasterURL, }, &cli.StringFlag{ Name: "storage-eos-slave-url", Value: "root://eos-example.org", Usage: "URL of the Slave EOS MGM", - EnvVar: "REVA_STORAGE_EOS_SLAVE_URL", + EnvVars: []string{"REVA_STORAGE_EOS_SLAVE_URL"}, Destination: &cfg.Reva.Storages.EOS.SlaveURL, }, &cli.StringFlag{ Name: "storage-eos-cache-directory", Value: os.TempDir(), Usage: "Location on the local fs where to store reads", - EnvVar: "REVA_STORAGE_EOS_CACHE_DIRECTORY", + EnvVars: []string{"REVA_STORAGE_EOS_CACHE_DIRECTORY"}, Destination: &cfg.Reva.Storages.EOS.CacheDirectory, }, &cli.BoolFlag{ Name: "storage-eos-enable-logging", Usage: "Enables logging of the commands executed", - EnvVar: "REVA_STORAGE_EOS_ENABLE_LOGGING", + EnvVars: []string{"REVA_STORAGE_EOS_ENABLE_LOGGING"}, Destination: &cfg.Reva.Storages.EOS.EnableLogging, }, &cli.BoolFlag{ Name: "storage-eos-show-hidden-sysfiles", Usage: "show internal EOS files like .sys.v# and .sys.a# files.", - EnvVar: "REVA_STORAGE_EOS_SHOW_HIDDEN_SYSFILES", + EnvVars: []string{"REVA_STORAGE_EOS_SHOW_HIDDEN_SYSFILES"}, Destination: &cfg.Reva.Storages.EOS.ShowHiddenSysFiles, }, &cli.BoolFlag{ Name: "storage-eos-force-singleuser-mode", Usage: "force connections to EOS to use SingleUsername", - EnvVar: "REVA_STORAGE_EOS_FORCE_SINGLEUSER_MODE", + EnvVars: []string{"REVA_STORAGE_EOS_FORCE_SINGLEUSER_MODE"}, Destination: &cfg.Reva.Storages.EOS.ForceSingleUserMode, }, &cli.BoolFlag{ Name: "storage-eos-use-keytab", Usage: "authenticate requests by using an EOS keytab", - EnvVar: "REVA_STORAGE_EOS_USE_KEYTAB", + EnvVars: []string{"REVA_STORAGE_EOS_USE_KEYTAB"}, Destination: &cfg.Reva.Storages.EOS.UseKeytab, }, &cli.StringFlag{ Name: "storage-eos-sec-protocol", Value: "", Usage: "the xrootd security protocol to use between the server and EOS", - EnvVar: "REVA_STORAGE_EOS_SEC_PROTOCOL", + EnvVars: []string{"REVA_STORAGE_EOS_SEC_PROTOCOL"}, Destination: &cfg.Reva.Storages.EOS.SecProtocol, }, &cli.StringFlag{ Name: "storage-eos-keytab", Value: "", Usage: "the location of the keytab to use to authenticate to EOS", - EnvVar: "REVA_STORAGE_EOS_KEYTAB", + EnvVars: []string{"REVA_STORAGE_EOS_KEYTAB"}, Destination: &cfg.Reva.Storages.EOS.Keytab, }, &cli.StringFlag{ Name: "storage-eos-single-username", Value: "", Usage: "the username to use when SingleUserMode is enabled", - EnvVar: "REVA_STORAGE_EOS_SINGLE_USERNAME", + EnvVars: []string{"REVA_STORAGE_EOS_SINGLE_USERNAME"}, Destination: &cfg.Reva.Storages.EOS.SingleUsername, }, @@ -243,7 +242,7 @@ func StorageOCDataWithConfig(cfg *config.Config) []cli.Flag { Name: "storage-local-root", Value: "/var/tmp/reva/root", Usage: "the path to the local storage root", - EnvVar: "REVA_STORAGE_LOCAL_ROOT", + EnvVars: []string{"REVA_STORAGE_LOCAL_ROOT"}, Destination: &cfg.Reva.Storages.Local.Root, }, @@ -253,7 +252,7 @@ func StorageOCDataWithConfig(cfg *config.Config) []cli.Flag { Name: "storage-owncloud-datadir", Value: "/var/tmp/reva/data", Usage: "the path to the owncloud data directory", - EnvVar: "REVA_STORAGE_OWNCLOUD_DATADIR", + EnvVars: []string{"REVA_STORAGE_OWNCLOUD_DATADIR"}, Destination: &cfg.Reva.Storages.OwnCloud.Datadirectory, }, @@ -263,7 +262,7 @@ func StorageOCDataWithConfig(cfg *config.Config) []cli.Flag { Name: "gateway-url", Value: "localhost:9142", Usage: "URL to use for the reva gateway service", - EnvVar: "REVA_GATEWAY_URL", + EnvVars: []string{"REVA_GATEWAY_URL"}, Destination: &cfg.Reva.Gateway.URL, }, } diff --git a/pkg/flagset/storageroot.go b/pkg/flagset/storageroot.go index 164522ad9..1dea42279 100644 --- a/pkg/flagset/storageroot.go +++ b/pkg/flagset/storageroot.go @@ -3,7 +3,7 @@ package flagset import ( "os" - "github.com/micro/cli" + "github.com/micro/cli/v2" "github.com/owncloud/ocis-reva/pkg/config" ) @@ -14,35 +14,35 @@ func StorageRootWithConfig(cfg *config.Config) []cli.Flag { &cli.BoolFlag{ Name: "tracing-enabled", Usage: "Enable sending traces", - EnvVar: "REVA_TRACING_ENABLED", + EnvVars: []string{"REVA_TRACING_ENABLED"}, Destination: &cfg.Tracing.Enabled, }, &cli.StringFlag{ Name: "tracing-type", Value: "jaeger", Usage: "Tracing backend type", - EnvVar: "REVA_TRACING_TYPE", + EnvVars: []string{"REVA_TRACING_TYPE"}, Destination: &cfg.Tracing.Type, }, &cli.StringFlag{ Name: "tracing-endpoint", Value: "", Usage: "Endpoint for the agent", - EnvVar: "REVA_TRACING_ENDPOINT", + EnvVars: []string{"REVA_TRACING_ENDPOINT"}, Destination: &cfg.Tracing.Endpoint, }, &cli.StringFlag{ Name: "tracing-collector", Value: "", Usage: "Endpoint for the collector", - EnvVar: "REVA_TRACING_COLLECTOR", + EnvVars: []string{"REVA_TRACING_COLLECTOR"}, Destination: &cfg.Tracing.Collector, }, &cli.StringFlag{ Name: "tracing-service", Value: "reva", Usage: "Service name for tracing", - EnvVar: "REVA_TRACING_SERVICE", + EnvVars: []string{"REVA_TRACING_SERVICE"}, Destination: &cfg.Tracing.Service, }, @@ -51,26 +51,26 @@ func StorageRootWithConfig(cfg *config.Config) []cli.Flag { Name: "debug-addr", Value: "0.0.0.0:9153", Usage: "Address to bind debug server", - EnvVar: "REVA_STORAGE_ROOT_DEBUG_ADDR", + EnvVars: []string{"REVA_STORAGE_ROOT_DEBUG_ADDR"}, Destination: &cfg.Reva.StorageRoot.DebugAddr, }, &cli.StringFlag{ Name: "debug-token", Value: "", Usage: "Token to grant metrics access", - EnvVar: "REVA_DEBUG_TOKEN", + EnvVars: []string{"REVA_DEBUG_TOKEN"}, Destination: &cfg.Debug.Token, }, &cli.BoolFlag{ Name: "debug-pprof", Usage: "Enable pprof debugging", - EnvVar: "REVA_DEBUG_PPROF", + EnvVars: []string{"REVA_DEBUG_PPROF"}, Destination: &cfg.Debug.Pprof, }, &cli.BoolFlag{ Name: "debug-zpages", Usage: "Enable zpages debugging", - EnvVar: "REVA_DEBUG_ZPAGES", + EnvVars: []string{"REVA_DEBUG_ZPAGES"}, Destination: &cfg.Debug.Zpages, }, @@ -80,7 +80,7 @@ func StorageRootWithConfig(cfg *config.Config) []cli.Flag { Name: "jwt-secret", Value: "Pive-Fumkiu4", Usage: "Shared jwt secret for reva service communication", - EnvVar: "REVA_JWT_SECRET", + EnvVars: []string{"REVA_JWT_SECRET"}, Destination: &cfg.Reva.JWTSecret, }, @@ -92,84 +92,83 @@ func StorageRootWithConfig(cfg *config.Config) []cli.Flag { Name: "network", Value: "tcp", Usage: "Network to use for the reva service, can be 'tcp', 'udp' or 'unix'", - EnvVar: "REVA_STORAGE_ROOT_NETWORK", + EnvVars: []string{"REVA_STORAGE_ROOT_NETWORK"}, Destination: &cfg.Reva.StorageRoot.Network, }, &cli.StringFlag{ Name: "protocol", Value: "grpc", Usage: "protocol for reva service, can be 'http' or 'grpc'", - EnvVar: "REVA_STORAGE_ROOT_PROTOCOL", + EnvVars: []string{"REVA_STORAGE_ROOT_PROTOCOL"}, Destination: &cfg.Reva.StorageRoot.Protocol, }, &cli.StringFlag{ Name: "addr", Value: "0.0.0.0:9152", Usage: "Address to bind reva service", - EnvVar: "REVA_STORAGE_ROOT_ADDR", + EnvVars: []string{"REVA_STORAGE_ROOT_ADDR"}, Destination: &cfg.Reva.StorageRoot.Addr, }, &cli.StringFlag{ Name: "url", Value: "localhost:9152", Usage: "URL to use for the reva service", - EnvVar: "REVA_STORAGE_ROOT_URL", + EnvVars: []string{"REVA_STORAGE_ROOT_URL"}, Destination: &cfg.Reva.StorageRoot.URL, }, &cli.StringFlag{ - Name: "services", - Value: "storageprovider", - Usage: "comma separated list of services to include in the storage-root service", - EnvVar: "REVA_STORAGE_ROOT_SERVICES", - Destination: &cfg.Reva.StorageRoot.Services, + Name: "service", + Value: "storageprovider", + Usage: "--service storageprovider [--service otherservice]", + EnvVars: []string{"REVA_STORAGE_ROOT_SERVICES"}, }, &cli.StringFlag{ Name: "driver", Value: "local", Usage: "storage driver, eg. local, eos, owncloud or s3", - EnvVar: "REVA_STORAGE_ROOT_DRIVER", + EnvVars: []string{"REVA_STORAGE_ROOT_DRIVER"}, Destination: &cfg.Reva.StorageRoot.Driver, }, &cli.StringFlag{ Name: "path-wrapper", Value: "", Usage: "path wrapper", - EnvVar: "REVA_STORAGE_ROOT_PATH_WRAPPER", + EnvVars: []string{"REVA_STORAGE_ROOT_PATH_WRAPPER"}, Destination: &cfg.Reva.StorageRoot.PathWrapper, }, &cli.StringFlag{ Name: "path-wrapper-context-prefix", Value: "", Usage: "path wrapper context prefix", - EnvVar: "REVA_STORAGE_ROOT_PATH_WRAPPER_CONTEXT_PREFIX", + EnvVars: []string{"REVA_STORAGE_ROOT_PATH_WRAPPER_CONTEXT_PREFIX"}, Destination: &cfg.Reva.StorageRoot.PathWrapperContext.Prefix, }, &cli.StringFlag{ Name: "mount-path", Value: "/", Usage: "mount path", - EnvVar: "REVA_STORAGE_ROOT_MOUNT_PATH", + EnvVars: []string{"REVA_STORAGE_ROOT_MOUNT_PATH"}, Destination: &cfg.Reva.StorageRoot.MountPath, }, &cli.StringFlag{ Name: "mount-id", Value: "123e4567-e89b-12d3-a456-426655440001", Usage: "mount id", - EnvVar: "REVA_STORAGE_ROOT_MOUNT_ID", + EnvVars: []string{"REVA_STORAGE_ROOT_MOUNT_ID"}, Destination: &cfg.Reva.StorageRoot.MountID, }, &cli.BoolFlag{ Name: "expose-data-server", Usage: "exposes a dedicated data server", - EnvVar: "REVA_STORAGE_ROOT_EXPOSE_DATA_SERVER", + EnvVars: []string{"REVA_STORAGE_ROOT_EXPOSE_DATA_SERVER"}, Destination: &cfg.Reva.StorageRoot.ExposeDataServer, }, &cli.StringFlag{ Name: "data-server-url", Value: "", Usage: "data server url", - EnvVar: "REVA_STORAGE_ROOT_DATA_SERVER_URL", + EnvVars: []string{"REVA_STORAGE_ROOT_DATA_SERVER_URL"}, Destination: &cfg.Reva.StorageRoot.DataServerURL, }, @@ -181,87 +180,87 @@ func StorageRootWithConfig(cfg *config.Config) []cli.Flag { Name: "storage-eos-namespace", Value: "", Usage: "Namespace for metadata operations", - EnvVar: "REVA_STORAGE_EOS_NAMESPACE", + EnvVars: []string{"REVA_STORAGE_EOS_NAMESPACE"}, Destination: &cfg.Reva.Storages.EOS.Namespace, }, &cli.StringFlag{ Name: "storage-eos-binary", Value: "/usr/bin/eos", Usage: "Location of the eos binary", - EnvVar: "REVA_STORAGE_EOS_BINARY", + EnvVars: []string{"REVA_STORAGE_EOS_BINARY"}, Destination: &cfg.Reva.Storages.EOS.EosBinary, }, &cli.StringFlag{ Name: "storage-eos-xrdcopy-binary", Value: "/usr/bin/xrdcopy", Usage: "Location of the xrdcopy binary", - EnvVar: "REVA_STORAGE_EOS_XRDCOPY_BINARY", + EnvVars: []string{"REVA_STORAGE_EOS_XRDCOPY_BINARY"}, Destination: &cfg.Reva.Storages.EOS.XrdcopyBinary, }, &cli.StringFlag{ Name: "storage-eos-master-url", Value: "root://eos-example.org", Usage: "URL of the Master EOS MGM", - EnvVar: "REVA_STORAGE_EOS_MASTER_URL", + EnvVars: []string{"REVA_STORAGE_EOS_MASTER_URL"}, Destination: &cfg.Reva.Storages.EOS.MasterURL, }, &cli.StringFlag{ Name: "storage-eos-slave-url", Value: "root://eos-example.org", Usage: "URL of the Slave EOS MGM", - EnvVar: "REVA_STORAGE_EOS_SLAVE_URL", + EnvVars: []string{"REVA_STORAGE_EOS_SLAVE_URL"}, Destination: &cfg.Reva.Storages.EOS.SlaveURL, }, &cli.StringFlag{ Name: "storage-eos-cache-directory", Value: os.TempDir(), Usage: "Location on the local fs where to store reads", - EnvVar: "REVA_STORAGE_EOS_CACHE_DIRECTORY", + EnvVars: []string{"REVA_STORAGE_EOS_CACHE_DIRECTORY"}, Destination: &cfg.Reva.Storages.EOS.CacheDirectory, }, &cli.BoolFlag{ Name: "storage-eos-enable-logging", Usage: "Enables logging of the commands executed", - EnvVar: "REVA_STORAGE_EOS_ENABLE_LOGGING", + EnvVars: []string{"REVA_STORAGE_EOS_ENABLE_LOGGING"}, Destination: &cfg.Reva.Storages.EOS.EnableLogging, }, &cli.BoolFlag{ Name: "storage-eos-show-hidden-sysfiles", Usage: "show internal EOS files like .sys.v# and .sys.a# files.", - EnvVar: "REVA_STORAGE_EOS_SHOW_HIDDEN_SYSFILES", + EnvVars: []string{"REVA_STORAGE_EOS_SHOW_HIDDEN_SYSFILES"}, Destination: &cfg.Reva.Storages.EOS.ShowHiddenSysFiles, }, &cli.BoolFlag{ Name: "storage-eos-force-singleuser-mode", Usage: "force connections to EOS to use SingleUsername", - EnvVar: "REVA_STORAGE_EOS_FORCE_SINGLEUSER_MODE", + EnvVars: []string{"REVA_STORAGE_EOS_FORCE_SINGLEUSER_MODE"}, Destination: &cfg.Reva.Storages.EOS.ForceSingleUserMode, }, &cli.BoolFlag{ Name: "storage-eos-use-keytab", Usage: "authenticate requests by using an EOS keytab", - EnvVar: "REVA_STORAGE_EOS_USE_KEYTAB", + EnvVars: []string{"REVA_STORAGE_EOS_USE_KEYTAB"}, Destination: &cfg.Reva.Storages.EOS.UseKeytab, }, &cli.StringFlag{ Name: "storage-eos-sec-protocol", Value: "", Usage: "the xrootd security protocol to use between the server and EOS", - EnvVar: "REVA_STORAGE_EOS_SEC_PROTOCOL", + EnvVars: []string{"REVA_STORAGE_EOS_SEC_PROTOCOL"}, Destination: &cfg.Reva.Storages.EOS.SecProtocol, }, &cli.StringFlag{ Name: "storage-eos-keytab", Value: "", Usage: "the location of the keytab to use to authenticate to EOS", - EnvVar: "REVA_STORAGE_EOS_KEYTAB", + EnvVars: []string{"REVA_STORAGE_EOS_KEYTAB"}, Destination: &cfg.Reva.Storages.EOS.Keytab, }, &cli.StringFlag{ Name: "storage-eos-single-username", Value: "", Usage: "the username to use when SingleUserMode is enabled", - EnvVar: "REVA_STORAGE_EOS_SINGLE_USERNAME", + EnvVars: []string{"REVA_STORAGE_EOS_SINGLE_USERNAME"}, Destination: &cfg.Reva.Storages.EOS.SingleUsername, }, @@ -271,7 +270,7 @@ func StorageRootWithConfig(cfg *config.Config) []cli.Flag { Name: "storage-local-root", Value: "/var/tmp/reva/root", Usage: "the path to the local storage root", - EnvVar: "REVA_STORAGE_LOCAL_ROOT", + EnvVars: []string{"REVA_STORAGE_LOCAL_ROOT"}, Destination: &cfg.Reva.Storages.Local.Root, }, @@ -281,7 +280,7 @@ func StorageRootWithConfig(cfg *config.Config) []cli.Flag { Name: "storage-owncloud-datadir", Value: "/var/tmp/reva/data", Usage: "the path to the owncloud data directory", - EnvVar: "REVA_STORAGE_OWNCLOUD_DATADIR", + EnvVars: []string{"REVA_STORAGE_OWNCLOUD_DATADIR"}, Destination: &cfg.Reva.Storages.OwnCloud.Datadirectory, }, } diff --git a/pkg/flagset/users.go b/pkg/flagset/users.go index 523cd265d..7b1ee79b1 100644 --- a/pkg/flagset/users.go +++ b/pkg/flagset/users.go @@ -1,7 +1,7 @@ package flagset import ( - "github.com/micro/cli" + "github.com/micro/cli/v2" "github.com/owncloud/ocis-reva/pkg/config" ) @@ -12,35 +12,35 @@ func UsersWithConfig(cfg *config.Config) []cli.Flag { &cli.BoolFlag{ Name: "tracing-enabled", Usage: "Enable sending traces", - EnvVar: "REVA_TRACING_ENABLED", + EnvVars: []string{"REVA_TRACING_ENABLED"}, Destination: &cfg.Tracing.Enabled, }, &cli.StringFlag{ Name: "tracing-type", Value: "jaeger", Usage: "Tracing backend type", - EnvVar: "REVA_TRACING_TYPE", + EnvVars: []string{"REVA_TRACING_TYPE"}, Destination: &cfg.Tracing.Type, }, &cli.StringFlag{ Name: "tracing-endpoint", Value: "", Usage: "Endpoint for the agent", - EnvVar: "REVA_TRACING_ENDPOINT", + EnvVars: []string{"REVA_TRACING_ENDPOINT"}, Destination: &cfg.Tracing.Endpoint, }, &cli.StringFlag{ Name: "tracing-collector", Value: "", Usage: "Endpoint for the collector", - EnvVar: "REVA_TRACING_COLLECTOR", + EnvVars: []string{"REVA_TRACING_COLLECTOR"}, Destination: &cfg.Tracing.Collector, }, &cli.StringFlag{ Name: "tracing-service", Value: "reva", Usage: "Service name for tracing", - EnvVar: "REVA_TRACING_SERVICE", + EnvVars: []string{"REVA_TRACING_SERVICE"}, Destination: &cfg.Tracing.Service, }, @@ -49,26 +49,26 @@ func UsersWithConfig(cfg *config.Config) []cli.Flag { Name: "debug-addr", Value: "0.0.0.0:9145", Usage: "Address to bind debug server", - EnvVar: "REVA_SHARING_DEBUG_ADDR", + EnvVars: []string{"REVA_SHARING_DEBUG_ADDR"}, Destination: &cfg.Reva.Users.DebugAddr, }, &cli.StringFlag{ Name: "debug-token", Value: "", Usage: "Token to grant metrics access", - EnvVar: "REVA_DEBUG_TOKEN", + EnvVars: []string{"REVA_DEBUG_TOKEN"}, Destination: &cfg.Debug.Token, }, &cli.BoolFlag{ Name: "debug-pprof", Usage: "Enable pprof debugging", - EnvVar: "REVA_DEBUG_PPROF", + EnvVars: []string{"REVA_DEBUG_PPROF"}, Destination: &cfg.Debug.Pprof, }, &cli.BoolFlag{ Name: "debug-zpages", Usage: "Enable zpages debugging", - EnvVar: "REVA_DEBUG_ZPAGES", + EnvVars: []string{"REVA_DEBUG_ZPAGES"}, Destination: &cfg.Debug.Zpages, }, @@ -78,7 +78,7 @@ func UsersWithConfig(cfg *config.Config) []cli.Flag { Name: "jwt-secret", Value: "Pive-Fumkiu4", Usage: "Shared jwt secret for reva service communication", - EnvVar: "REVA_JWT_SECRET", + EnvVars: []string{"REVA_JWT_SECRET"}, Destination: &cfg.Reva.JWTSecret, }, @@ -88,49 +88,49 @@ func UsersWithConfig(cfg *config.Config) []cli.Flag { Name: "ldap-hostname", Value: "localhost", Usage: "LDAP hostname", - EnvVar: "REVA_LDAP_HOSTNAME", + EnvVars: []string{"REVA_LDAP_HOSTNAME"}, Destination: &cfg.Reva.LDAP.Hostname, }, &cli.IntFlag{ Name: "ldap-port", Value: 636, Usage: "LDAP port", - EnvVar: "REVA_LDAP_PORT", + EnvVars: []string{"REVA_LDAP_PORT"}, Destination: &cfg.Reva.LDAP.Port, }, &cli.StringFlag{ Name: "ldap-base-dn", Value: "dc=owncloud,dc=com", Usage: "LDAP basedn", - EnvVar: "REVA_LDAP_BASE_DN", + EnvVars: []string{"REVA_LDAP_BASE_DN"}, Destination: &cfg.Reva.LDAP.BaseDN, }, &cli.StringFlag{ Name: "ldap-userfilter", Value: "(&(objectclass=posixAccount)(cn=%s))", Usage: "LDAP userfilter", - EnvVar: "REVA_LDAP_USERFILTER", + EnvVars: []string{"REVA_LDAP_USERFILTER"}, Destination: &cfg.Reva.LDAP.UserFilter, }, &cli.StringFlag{ Name: "ldap-groupfilter", Value: "(&(objectclass=posixGroup)(cn=%s))", Usage: "LDAP groupfilter", - EnvVar: "REVA_LDAP_GROUPFILTER", + EnvVars: []string{"REVA_LDAP_GROUPFILTER"}, Destination: &cfg.Reva.LDAP.GroupFilter, }, &cli.StringFlag{ Name: "ldap-bind-dn", Value: "cn=admin,dc=owncloud,dc=com", Usage: "LDAP bind dn", - EnvVar: "REVA_LDAP_BIND_DN", + EnvVars: []string{"REVA_LDAP_BIND_DN"}, Destination: &cfg.Reva.LDAP.BindDN, }, &cli.StringFlag{ Name: "ldap-bind-password", Value: "admin", Usage: "LDAP bind password", - EnvVar: "REVA_LDAP_BIND_PASSWORD", + EnvVars: []string{"REVA_LDAP_BIND_PASSWORD"}, Destination: &cfg.Reva.LDAP.BindPassword, }, // ldap dn is always the dn @@ -138,28 +138,28 @@ func UsersWithConfig(cfg *config.Config) []cli.Flag { Name: "ldap-schema-uid", Value: "uid", Usage: "LDAP schema uid", - EnvVar: "REVA_LDAP_SCHEMA_UID", + EnvVars: []string{"REVA_LDAP_SCHEMA_UID"}, Destination: &cfg.Reva.LDAP.Schema.UID, }, &cli.StringFlag{ Name: "ldap-schema-mail", Value: "mail", Usage: "LDAP schema mail", - EnvVar: "REVA_LDAP_SCHEMA_MAIL", + EnvVars: []string{"REVA_LDAP_SCHEMA_MAIL"}, Destination: &cfg.Reva.LDAP.Schema.Mail, }, &cli.StringFlag{ Name: "ldap-schema-displayName", Value: "displayName", Usage: "LDAP schema displayName", - EnvVar: "REVA_LDAP_SCHEMA_DISPLAYNAME", + EnvVars: []string{"REVA_LDAP_SCHEMA_DISPLAYNAME"}, Destination: &cfg.Reva.LDAP.Schema.DisplayName, }, &cli.StringFlag{ Name: "ldap-schema-cn", Value: "cn", Usage: "LDAP schema cn", - EnvVar: "REVA_LDAP_SCHEMA_CN", + EnvVars: []string{"REVA_LDAP_SCHEMA_CN"}, Destination: &cfg.Reva.LDAP.Schema.CN, }, @@ -171,50 +171,49 @@ func UsersWithConfig(cfg *config.Config) []cli.Flag { Name: "network", Value: "tcp", Usage: "Network to use for the reva service, can be 'tcp', 'udp' or 'unix'", - EnvVar: "REVA_USERS_NETWORK", + EnvVars: []string{"REVA_USERS_NETWORK"}, Destination: &cfg.Reva.Users.Network, }, &cli.StringFlag{ Name: "protocol", Value: "grpc", Usage: "protocol for reva service, can be 'http' or 'grpc'", - EnvVar: "REVA_USERS_PROTOCOL", + EnvVars: []string{"REVA_USERS_PROTOCOL"}, Destination: &cfg.Reva.Users.Protocol, }, &cli.StringFlag{ Name: "addr", Value: "0.0.0.0:9144", Usage: "Address to bind reva service", - EnvVar: "REVA_USERS_ADDR", + EnvVars: []string{"REVA_USERS_ADDR"}, Destination: &cfg.Reva.Users.Addr, }, &cli.StringFlag{ Name: "url", Value: "localhost:9144", Usage: "URL to use for the reva service", - EnvVar: "REVA_USERS_URL", + EnvVars: []string{"REVA_USERS_URL"}, Destination: &cfg.Reva.Users.URL, }, &cli.StringFlag{ - Name: "services", - Value: "userprovider", // TODO preferences - Usage: "comma separated list of services to include", - EnvVar: "REVA_USERS_SERVICES", - Destination: &cfg.Reva.Users.Services, + Name: "service", + Value: "userprovider", // TODO preferences + Usage: "--service userprovider [--service otherservice]", + EnvVars: []string{"REVA_USERS_SERVICES"}, }, &cli.StringFlag{ Name: "driver", Value: "demo", Usage: "user driver: 'demo', 'json' or 'ldap'", - EnvVar: "REVA_USERS_DRIVER", + EnvVars: []string{"REVA_USERS_DRIVER"}, Destination: &cfg.Reva.Users.Driver, }, &cli.StringFlag{ Name: "json-config", Value: "", Usage: "Path to users.json file", - EnvVar: "REVA_USERS_JSON", + EnvVars: []string{"REVA_USERS_JSON"}, Destination: &cfg.Reva.Users.JSON, }, }