config cleanup

This commit is contained in:
Jörn Friedrich Dreyer
2020-09-01 12:12:52 +02:00
parent cfe5774212
commit c99861130f
33 changed files with 841 additions and 2828 deletions

31
pkg/flagset/debug.go Normal file
View File

@@ -0,0 +1,31 @@
package flagset
import (
"github.com/micro/cli/v2"
"github.com/owncloud/ocis-reva/pkg/config"
)
// DebugWithConfig applies common debug config cfg to the flagset
func DebugWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "debug-token",
Value: "",
Usage: "Token to grant metrics access",
EnvVars: []string{"REVA_DEBUG_TOKEN"},
Destination: &cfg.Debug.Token,
},
&cli.BoolFlag{
Name: "debug-pprof",
Usage: "Enable pprof debugging",
EnvVars: []string{"REVA_DEBUG_PPROF"},
Destination: &cfg.Debug.Pprof,
},
&cli.BoolFlag{
Name: "debug-zpages",
Usage: "Enable zpages debugging",
EnvVars: []string{"REVA_DEBUG_ZPAGES"},
Destination: &cfg.Debug.Zpages,
},
}
}