diff --git a/go.mod b/go.mod index e3cbc9bc2d..e8c551ab75 100644 --- a/go.mod +++ b/go.mod @@ -10,6 +10,7 @@ require ( github.com/go-chi/chi v4.0.2+incompatible github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect github.com/micro/cli v0.2.0 + github.com/micro/cli/v2 v2.1.1 github.com/ogier/pflag v0.0.1 // indirect github.com/oklog/run v1.0.0 github.com/openzipkin/zipkin-go v0.2.2 diff --git a/go.sum b/go.sum index 27e8babe8a..50c37a93c1 100644 --- a/go.sum +++ b/go.sum @@ -153,6 +153,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 h1:6pwm8kMQKCmgUg0ZHTm5+/YvRK0s3THD/28+T6/kk4A= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= @@ -426,6 +427,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 h1:BhwC4Lnwr3hdci9T8kN5MEabKS+CT0QT0YH4hinTdNs= github.com/micro/go-micro v1.17.1/go.mod h1:klwUJL1gkdY1MHFyz+fFJXn52dKcty4hoe95Mp571AA= @@ -576,6 +579,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= @@ -587,6 +591,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= diff --git a/pkg/command/health.go b/pkg/command/health.go index 5e73a22cda..e7493fa521 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-ocs/pkg/config" "github.com/owncloud/ocis-ocs/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 37e6da5e0f..aa21b55cb6 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-ocs/pkg/config" "github.com/owncloud/ocis-ocs/pkg/flagset" "github.com/owncloud/ocis-ocs/pkg/version" @@ -22,7 +22,7 @@ func Execute() error { Usage: "Serve OCS API for 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{ Server(cfg), Health(cfg), }, diff --git a/pkg/command/server.go b/pkg/command/server.go index 9028a0f814..cc15cc1cb9 100644 --- a/pkg/command/server.go +++ b/pkg/command/server.go @@ -10,7 +10,7 @@ import ( "contrib.go.opencensus.io/exporter/jaeger" "contrib.go.opencensus.io/exporter/ocagent" "contrib.go.opencensus.io/exporter/zipkin" - "github.com/micro/cli" + "github.com/micro/cli/v2" "github.com/oklog/run" openzipkin "github.com/openzipkin/zipkin-go" zipkinhttp "github.com/openzipkin/zipkin-go/reporter/http" @@ -24,8 +24,8 @@ import ( ) // Server is the entrypoint for the server command. -func Server(cfg *config.Config) cli.Command { - return cli.Command{ +func Server(cfg *config.Config) *cli.Command { + return &cli.Command{ Name: "server", Usage: "Start integrated server", Flags: flagset.ServerWithConfig(cfg), diff --git a/pkg/flagset/flagset.go b/pkg/flagset/flagset.go index 2bd8a3e964..ab1c7a5395 100644 --- a/pkg/flagset/flagset.go +++ b/pkg/flagset/flagset.go @@ -1,7 +1,7 @@ package flagset import ( - "github.com/micro/cli" + "github.com/micro/cli/v2" "github.com/owncloud/ocis-ocs/pkg/config" ) @@ -12,26 +12,26 @@ func RootWithConfig(cfg *config.Config) []cli.Flag { Name: "config-file", Value: "", Usage: "Path to config file", - EnvVar: "OCS_CONFIG_FILE", + EnvVars: []string{"OCS_CONFIG_FILE"}, Destination: &cfg.File, }, &cli.StringFlag{ Name: "log-level", Value: "info", Usage: "Set logging level", - EnvVar: "OCS_LOG_LEVEL", + EnvVars: []string{"OCS_LOG_LEVEL"}, Destination: &cfg.Log.Level, }, - &cli.BoolTFlag{ + &cli.BoolFlag{ Name: "log-pretty", Usage: "Enable pretty logging", - EnvVar: "OCS_LOG_PRETTY", + EnvVars: []string{"OCS_LOG_PRETTY"}, Destination: &cfg.Log.Pretty, }, - &cli.BoolTFlag{ + &cli.BoolFlag{ Name: "log-color", Usage: "Enable colored logging", - EnvVar: "OCS_LOG_COLOR", + EnvVars: []string{"OCS_LOG_COLOR"}, Destination: &cfg.Log.Color, }, } @@ -44,7 +44,7 @@ func HealthWithConfig(cfg *config.Config) []cli.Flag { Name: "debug-addr", Value: "0.0.0.0:9114", Usage: "Address to debug endpoint", - EnvVar: "OCS_DEBUG_ADDR", + EnvVars: []string{"OCS_DEBUG_ADDR"}, Destination: &cfg.Debug.Addr, }, } @@ -56,82 +56,82 @@ func ServerWithConfig(cfg *config.Config) []cli.Flag { &cli.BoolFlag{ Name: "tracing-enabled", Usage: "Enable sending traces", - EnvVar: "OCS_TRACING_ENABLED", + EnvVars: []string{"OCS_TRACING_ENABLED"}, Destination: &cfg.Tracing.Enabled, }, &cli.StringFlag{ Name: "tracing-type", Value: "jaeger", Usage: "Tracing backend type", - EnvVar: "OCS_TRACING_TYPE", + EnvVars: []string{"OCS_TRACING_TYPE"}, Destination: &cfg.Tracing.Type, }, &cli.StringFlag{ Name: "tracing-endpoint", Value: "", Usage: "Endpoint for the agent", - EnvVar: "OCS_TRACING_ENDPOINT", + EnvVars: []string{"OCS_TRACING_ENDPOINT"}, Destination: &cfg.Tracing.Endpoint, }, &cli.StringFlag{ Name: "tracing-collector", Value: "", Usage: "Endpoint for the collector", - EnvVar: "OCS_TRACING_COLLECTOR", + EnvVars: []string{"OCS_TRACING_COLLECTOR"}, Destination: &cfg.Tracing.Collector, }, &cli.StringFlag{ Name: "tracing-service", Value: "ocs", Usage: "Service name for tracing", - EnvVar: "OCS_TRACING_SERVICE", + EnvVars: []string{"OCS_TRACING_SERVICE"}, Destination: &cfg.Tracing.Service, }, &cli.StringFlag{ Name: "debug-addr", Value: "0.0.0.0:9114", Usage: "Address to bind debug server", - EnvVar: "OCS_DEBUG_ADDR", + EnvVars: []string{"OCS_DEBUG_ADDR"}, Destination: &cfg.Debug.Addr, }, &cli.StringFlag{ Name: "debug-token", Value: "", Usage: "Token to grant metrics access", - EnvVar: "OCS_DEBUG_TOKEN", + EnvVars: []string{"OCS_DEBUG_TOKEN"}, Destination: &cfg.Debug.Token, }, &cli.BoolFlag{ Name: "debug-pprof", Usage: "Enable pprof debugging", - EnvVar: "OCS_DEBUG_PPROF", + EnvVars: []string{"OCS_DEBUG_PPROF"}, Destination: &cfg.Debug.Pprof, }, &cli.BoolFlag{ Name: "debug-zpages", Usage: "Enable zpages debugging", - EnvVar: "OCS_DEBUG_ZPAGES", + EnvVars: []string{"OCS_DEBUG_ZPAGES"}, Destination: &cfg.Debug.Zpages, }, &cli.StringFlag{ Name: "http-addr", Value: "0.0.0.0:9110", Usage: "Address to bind http server", - EnvVar: "OCS_HTTP_ADDR", + EnvVars: []string{"OCS_HTTP_ADDR"}, Destination: &cfg.HTTP.Addr, }, &cli.StringFlag{ Name: "http-namespace", Value: "com.owncloud.web", Usage: "Set the base namespace for the http namespace", - EnvVar: "OCS_NAMESPACE", + EnvVars: []string{"OCS_NAMESPACE"}, Destination: &cfg.HTTP.Namespace, }, &cli.StringFlag{ Name: "http-root", Value: "/", Usage: "Root path of http server", - EnvVar: "OCS_HTTP_ROOT", + EnvVars: []string{"OCS_HTTP_ROOT"}, Destination: &cfg.HTTP.Root, }, } diff --git a/pkg/server/http/option.go b/pkg/server/http/option.go index d7fd3bc2d7..635677177a 100644 --- a/pkg/server/http/option.go +++ b/pkg/server/http/option.go @@ -3,7 +3,7 @@ package http import ( "context" - "github.com/micro/cli" + "github.com/micro/cli/v2" "github.com/owncloud/ocis-ocs/pkg/config" "github.com/owncloud/ocis-ocs/pkg/metrics" "github.com/owncloud/ocis-pkg/log"