Files
ocis/pkg/flagset/authbasic.go
T

222 lines
6.3 KiB
Go
Raw Normal View History

2020-01-15 17:02:56 +01:00
package flagset
import (
2020-01-28 14:41:18 +01:00
"github.com/micro/cli/v2"
2020-01-15 17:02:56 +01:00
"github.com/owncloud/ocis-reva/pkg/config"
)
// AuthBasicWithConfig applies cfg to the root flagset
func AuthBasicWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.BoolFlag{
Name: "tracing-enabled",
Usage: "Enable sending traces",
2020-01-28 14:41:18 +01:00
EnvVars: []string{"REVA_TRACING_ENABLED"},
2020-01-15 17:02:56 +01:00
Destination: &cfg.Tracing.Enabled,
},
&cli.StringFlag{
Name: "tracing-type",
Value: "jaeger",
Usage: "Tracing backend type",
2020-01-28 14:41:18 +01:00
EnvVars: []string{"REVA_TRACING_TYPE"},
2020-01-15 17:02:56 +01:00
Destination: &cfg.Tracing.Type,
},
&cli.StringFlag{
Name: "tracing-endpoint",
Value: "",
Usage: "Endpoint for the agent",
2020-01-28 14:41:18 +01:00
EnvVars: []string{"REVA_TRACING_ENDPOINT"},
2020-01-15 17:02:56 +01:00
Destination: &cfg.Tracing.Endpoint,
},
&cli.StringFlag{
Name: "tracing-collector",
Value: "",
Usage: "Endpoint for the collector",
2020-01-28 14:41:18 +01:00
EnvVars: []string{"REVA_TRACING_COLLECTOR"},
2020-01-15 17:02:56 +01:00
Destination: &cfg.Tracing.Collector,
},
&cli.StringFlag{
Name: "tracing-service",
Value: "reva",
Usage: "Service name for tracing",
2020-01-28 14:41:18 +01:00
EnvVars: []string{"REVA_TRACING_SERVICE"},
2020-01-15 17:02:56 +01:00
Destination: &cfg.Tracing.Service,
},
// debug ports are the odd ports
&cli.StringFlag{
Name: "debug-addr",
Value: "0.0.0.0:9147",
Usage: "Address to bind debug server",
2020-01-28 14:41:18 +01:00
EnvVars: []string{"REVA_AUTH_BASIC_DEBUG_ADDR"},
2020-01-15 17:02:56 +01:00
Destination: &cfg.Reva.AuthBasic.DebugAddr,
},
&cli.StringFlag{
Name: "debug-token",
Value: "",
Usage: "Token to grant metrics access",
2020-01-28 14:41:18 +01:00
EnvVars: []string{"REVA_DEBUG_TOKEN"},
2020-01-15 17:02:56 +01:00
Destination: &cfg.Debug.Token,
},
&cli.BoolFlag{
Name: "debug-pprof",
Usage: "Enable pprof debugging",
2020-01-28 14:41:18 +01:00
EnvVars: []string{"REVA_DEBUG_PPROF"},
2020-01-15 17:02:56 +01:00
Destination: &cfg.Debug.Pprof,
},
&cli.BoolFlag{
Name: "debug-zpages",
Usage: "Enable zpages debugging",
2020-01-28 14:41:18 +01:00
EnvVars: []string{"REVA_DEBUG_ZPAGES"},
2020-01-15 17:02:56 +01:00
Destination: &cfg.Debug.Zpages,
},
// REVA
&cli.StringFlag{
Name: "jwt-secret",
Value: "Pive-Fumkiu4",
Usage: "Shared jwt secret for reva service communication",
2020-01-28 14:41:18 +01:00
EnvVars: []string{"REVA_JWT_SECRET"},
2020-01-15 17:02:56 +01:00
Destination: &cfg.Reva.JWTSecret,
},
// Users
&cli.StringFlag{
Name: "users-driver",
Value: "demo",
Usage: "user driver: 'demo', 'json' or 'ldap'",
2020-01-28 14:41:18 +01:00
EnvVars: []string{"REVA_USERS_DRIVER"},
2020-01-15 17:02:56 +01:00
Destination: &cfg.Reva.Users.Driver,
},
&cli.StringFlag{
Name: "users-json",
Value: "",
Usage: "Path to users.json file",
2020-01-28 14:41:18 +01:00
EnvVars: []string{"REVA_USERS_JSON"},
2020-01-15 17:02:56 +01:00
Destination: &cfg.Reva.Users.JSON,
},
// LDAP
&cli.StringFlag{
Name: "ldap-hostname",
Value: "localhost",
Usage: "LDAP hostname",
2020-01-28 14:41:18 +01:00
EnvVars: []string{"REVA_LDAP_HOSTNAME"},
2020-01-15 17:02:56 +01:00
Destination: &cfg.Reva.LDAP.Hostname,
},
&cli.IntFlag{
Name: "ldap-port",
2020-01-17 13:36:51 +01:00
Value: 636,
2020-01-15 17:02:56 +01:00
Usage: "LDAP port",
2020-01-28 14:41:18 +01:00
EnvVars: []string{"REVA_LDAP_PORT"},
2020-01-15 17:02:56 +01:00
Destination: &cfg.Reva.LDAP.Port,
},
&cli.StringFlag{
Name: "ldap-base-dn",
Value: "dc=owncloud,dc=com",
Usage: "LDAP basedn",
2020-01-28 14:41:18 +01:00
EnvVars: []string{"REVA_LDAP_BASE_DN"},
2020-01-15 17:02:56 +01:00
Destination: &cfg.Reva.LDAP.BaseDN,
},
&cli.StringFlag{
Name: "ldap-userfilter",
2020-01-17 13:36:51 +01:00
Value: "(&(objectclass=posixAccount)(cn=%s))",
2020-01-15 17:02:56 +01:00
Usage: "LDAP userfilter",
2020-01-28 14:41:18 +01:00
EnvVars: []string{"REVA_LDAP_USERFILTER"},
2020-01-15 17:02:56 +01:00
Destination: &cfg.Reva.LDAP.UserFilter,
},
&cli.StringFlag{
Name: "ldap-groupfilter",
2020-01-17 13:36:51 +01:00
Value: "(&(objectclass=posixGroup)(cn=%s))",
2020-01-15 17:02:56 +01:00
Usage: "LDAP groupfilter",
2020-01-28 14:41:18 +01:00
EnvVars: []string{"REVA_LDAP_GROUPFILTER"},
2020-01-15 17:02:56 +01:00
Destination: &cfg.Reva.LDAP.GroupFilter,
},
&cli.StringFlag{
Name: "ldap-bind-dn",
Value: "cn=admin,dc=owncloud,dc=com",
Usage: "LDAP bind dn",
2020-01-28 14:41:18 +01:00
EnvVars: []string{"REVA_LDAP_BIND_DN"},
2020-01-15 17:02:56 +01:00
Destination: &cfg.Reva.LDAP.BindDN,
},
&cli.StringFlag{
Name: "ldap-bind-password",
Value: "admin",
Usage: "LDAP bind password",
2020-01-28 14:41:18 +01:00
EnvVars: []string{"REVA_LDAP_BIND_PASSWORD"},
2020-01-15 17:02:56 +01:00
Destination: &cfg.Reva.LDAP.BindPassword,
},
// ldap dn is always the dn
&cli.StringFlag{
Name: "ldap-schema-uid",
Value: "uid",
Usage: "LDAP schema uid",
2020-01-28 14:41:18 +01:00
EnvVars: []string{"REVA_LDAP_SCHEMA_UID"},
2020-01-15 17:02:56 +01:00
Destination: &cfg.Reva.LDAP.Schema.UID,
},
&cli.StringFlag{
Name: "ldap-schema-mail",
Value: "mail",
Usage: "LDAP schema mail",
2020-01-28 14:41:18 +01:00
EnvVars: []string{"REVA_LDAP_SCHEMA_Mail"},
2020-01-15 17:02:56 +01:00
Destination: &cfg.Reva.LDAP.Schema.Mail,
},
&cli.StringFlag{
Name: "ldap-schema-displayName",
Value: "displayName",
Usage: "LDAP schema displayName",
2020-01-28 14:41:18 +01:00
EnvVars: []string{"REVA_LDAP_SCHEMA_DISPLAYNAME"},
2020-01-15 17:02:56 +01:00
Destination: &cfg.Reva.LDAP.Schema.DisplayName,
},
&cli.StringFlag{
Name: "ldap-schema-cn",
Value: "cn",
Usage: "LDAP schema cn",
2020-01-28 14:41:18 +01:00
EnvVars: []string{"REVA_LDAP_SCHEMA_CN"},
2020-01-15 17:02:56 +01:00
Destination: &cfg.Reva.LDAP.Schema.CN,
},
// Services
// AuthBasic
&cli.StringFlag{
Name: "network",
Value: "tcp",
Usage: "Network to use for the reva auth-basic service, can be 'tcp', 'udp' or 'unix'",
2020-01-28 14:41:18 +01:00
EnvVars: []string{"REVA_AUTH_BASIC_NETWORK"},
2020-01-15 17:02:56 +01:00
Destination: &cfg.Reva.AuthBasic.Network,
},
&cli.StringFlag{
Name: "protocol",
Value: "grpc",
Usage: "protocol for reva service, can be 'http' or 'grpc'",
2020-01-28 14:41:18 +01:00
EnvVars: []string{"REVA_AUTH_BASIC_PROTOCOL"},
2020-01-15 17:02:56 +01:00
Destination: &cfg.Reva.AuthBasic.Protocol,
},
&cli.StringFlag{
Name: "addr",
Value: "0.0.0.0:9146",
Usage: "Address to bind reva service",
2020-01-28 14:41:18 +01:00
EnvVars: []string{"REVA_AUTH_BASIC_ADDR"},
2020-01-15 17:02:56 +01:00
Destination: &cfg.Reva.AuthBasic.Addr,
},
&cli.StringFlag{
Name: "url",
Value: "localhost:9146",
Usage: "URL to use for the reva service",
2020-01-28 14:41:18 +01:00
EnvVars: []string{"REVA_AUTH_BASIC_URL"},
2020-01-15 17:02:56 +01:00
Destination: &cfg.Reva.AuthBasic.URL,
},
2020-01-28 14:41:18 +01:00
&cli.StringSliceFlag{
Name: "service",
Value: cli.NewStringSlice("authprovider"),
Usage: "--service authprovider [--service otherservice]",
EnvVars: []string{"REVA_AUTH_BASIC_SERVICES"},
2020-01-15 17:02:56 +01:00
},
}
}