mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-02-01 09:51:42 -05:00
96 lines
2.6 KiB
Go
96 lines
2.6 KiB
Go
package flagset
|
|
|
|
import (
|
|
"github.com/micro/cli/v2"
|
|
"github.com/owncloud/ocis-accounts/pkg/config"
|
|
)
|
|
|
|
// RootWithConfig applies cfg to the root flagset
|
|
func RootWithConfig(cfg *config.Config) []cli.Flag {
|
|
return []cli.Flag{
|
|
&cli.StringFlag{
|
|
Name: "log-level",
|
|
Value: "info",
|
|
Usage: "Set logging level",
|
|
EnvVars: []string{"ACCOUNTS_LOG_LEVEL"},
|
|
Destination: &cfg.Log.Level,
|
|
},
|
|
&cli.BoolFlag{
|
|
Value: true,
|
|
Name: "log-pretty",
|
|
Usage: "Enable pretty logging",
|
|
EnvVars: []string{"ACCOUNTS_LOG_PRETTY"},
|
|
Destination: &cfg.Log.Pretty,
|
|
},
|
|
&cli.BoolFlag{
|
|
Value: true,
|
|
Name: "log-color",
|
|
Usage: "Enable colored logging",
|
|
EnvVars: []string{"ACCOUNTS_LOG_COLOR"},
|
|
Destination: &cfg.Log.Color,
|
|
},
|
|
}
|
|
}
|
|
|
|
// ServerWithConfig applies cfg to the root flagset
|
|
func ServerWithConfig(cfg *config.Config) []cli.Flag {
|
|
return []cli.Flag{
|
|
&cli.StringFlag{
|
|
Name: "http-namespace",
|
|
Value: "com.owncloud.web",
|
|
Usage: "Set the base namespace for the http namespace",
|
|
EnvVars: []string{"ACCOUNTS_HTTP_NAMESPACE"},
|
|
Destination: &cfg.HTTP.Namespace,
|
|
},
|
|
&cli.StringFlag{
|
|
Name: "http-addr",
|
|
Value: "0.0.0.0:9181",
|
|
Usage: "Address to bind http server",
|
|
EnvVars: []string{"ACCOUNTS_HTTP_ADDR"},
|
|
Destination: &cfg.HTTP.Addr,
|
|
},
|
|
&cli.StringFlag{
|
|
Name: "http-root",
|
|
Value: "/",
|
|
Usage: "Root path of http server",
|
|
EnvVars: []string{"ACCOUNTS_HTTP_ROOT"},
|
|
Destination: &cfg.HTTP.Root,
|
|
},
|
|
&cli.StringFlag{
|
|
Name: "grpc-namespace",
|
|
Value: "com.owncloud.api",
|
|
Usage: "Set the base namespace for the grpc namespace",
|
|
EnvVars: []string{"ACCOUNTS_GRPC_NAMESPACE"},
|
|
Destination: &cfg.GRPC.Namespace,
|
|
},
|
|
&cli.StringFlag{
|
|
Name: "grpc-addr",
|
|
Value: "0.0.0.0:9180",
|
|
Usage: "Address to bind grpc server",
|
|
EnvVars: []string{"ACCOUNTS_GRPC_ADDR"},
|
|
Destination: &cfg.GRPC.Addr,
|
|
},
|
|
&cli.StringFlag{
|
|
Name: "name",
|
|
Value: "accounts",
|
|
Usage: "service name",
|
|
EnvVars: []string{"ACCOUNTS_NAME"},
|
|
Destination: &cfg.Server.Name,
|
|
},
|
|
&cli.StringFlag{
|
|
Name: "accounts-data-path",
|
|
Value: "/var/tmp/ocis-accounts",
|
|
Usage: "accounts folder",
|
|
EnvVars: []string{"ACCOUNTS_DATA_PATH"},
|
|
Destination: &cfg.Server.AccountsDataPath,
|
|
},
|
|
&cli.StringFlag{
|
|
Name: "asset-path",
|
|
Value: "",
|
|
Usage: "Path to custom assets",
|
|
EnvVars: []string{"HELLO_ASSET_PATH"},
|
|
Destination: &cfg.Asset.Path,
|
|
},
|
|
}
|
|
}
|