mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-05-06 11:31:00 -05:00
update config parsing for accounts and proxy
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"github.com/micro/cli/v2"
|
||||
"github.com/owncloud/ocis/accounts/pkg/config"
|
||||
accounts "github.com/owncloud/ocis/accounts/pkg/proto/v0"
|
||||
"github.com/owncloud/ocis/ocis-pkg/flags"
|
||||
)
|
||||
|
||||
// RootWithConfig applies cfg to the root flagset
|
||||
@@ -41,189 +42,189 @@ func ServerWithConfig(cfg *config.Config) []cli.Flag {
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "tracing-type",
|
||||
Value: "jaeger",
|
||||
Value: flags.OverrideDefaultString(cfg.Tracing.Type, "jaeger"),
|
||||
Usage: "Tracing backend type",
|
||||
EnvVars: []string{"ACCOUNTS_TRACING_TYPE"},
|
||||
Destination: &cfg.Tracing.Type,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "tracing-endpoint",
|
||||
Value: "",
|
||||
Value: flags.OverrideDefaultString(cfg.Tracing.Endpoint, ""),
|
||||
Usage: "Endpoint for the agent",
|
||||
EnvVars: []string{"ACCOUNTS_TRACING_ENDPOINT"},
|
||||
Destination: &cfg.Tracing.Endpoint,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "tracing-collector",
|
||||
Value: "",
|
||||
Value: flags.OverrideDefaultString(cfg.Tracing.Collector, ""),
|
||||
Usage: "Endpoint for the collector",
|
||||
EnvVars: []string{"ACCOUNTS_TRACING_COLLECTOR"},
|
||||
Destination: &cfg.Tracing.Collector,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "tracing-service",
|
||||
Value: "accounts",
|
||||
Value: flags.OverrideDefaultString(cfg.Tracing.Service, "accounts"),
|
||||
Usage: "Service name for tracing",
|
||||
EnvVars: []string{"ACCOUNTS_TRACING_SERVICE"},
|
||||
Destination: &cfg.Tracing.Service,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "http-namespace",
|
||||
Value: "com.owncloud.web",
|
||||
Value: flags.OverrideDefaultString(cfg.HTTP.Namespace, "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",
|
||||
Value: flags.OverrideDefaultString(cfg.HTTP.Addr, "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: "/",
|
||||
Value: flags.OverrideDefaultString(cfg.HTTP.Root, "/"),
|
||||
Usage: "Root path of http server",
|
||||
EnvVars: []string{"ACCOUNTS_HTTP_ROOT"},
|
||||
Destination: &cfg.HTTP.Root,
|
||||
},
|
||||
&cli.IntFlag{
|
||||
Name: "http-cache-ttl",
|
||||
Value: 604800, // 7 days
|
||||
Value: flags.OverrideDefaultInt(cfg.HTTP.CacheTTL, 604800),
|
||||
Usage: "Set the static assets caching duration in seconds",
|
||||
EnvVars: []string{"ACCOUNTS_CACHE_TTL"},
|
||||
Destination: &cfg.HTTP.CacheTTL,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "grpc-namespace",
|
||||
Value: "com.owncloud.api",
|
||||
Value: flags.OverrideDefaultString(cfg.GRPC.Namespace, "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",
|
||||
Value: flags.OverrideDefaultString(cfg.GRPC.Addr, "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",
|
||||
Value: flags.OverrideDefaultString(cfg.Server.Name, "accounts"),
|
||||
Usage: "service name",
|
||||
EnvVars: []string{"ACCOUNTS_NAME"},
|
||||
Destination: &cfg.Server.Name,
|
||||
},
|
||||
&cli.IntFlag{
|
||||
Name: "accounts-hash-difficulty",
|
||||
Value: 11,
|
||||
Value: flags.OverrideDefaultInt(cfg.Server.HashDifficulty, 11),
|
||||
Usage: "accounts password hash difficulty",
|
||||
EnvVars: []string{"ACCOUNTS_HASH_DIFFICULTY"},
|
||||
Destination: &cfg.Server.HashDifficulty,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "asset-path",
|
||||
Value: "",
|
||||
Value: flags.OverrideDefaultString(cfg.Asset.Path, ""),
|
||||
Usage: "Path to custom assets",
|
||||
EnvVars: []string{"ACCOUNTS_ASSET_PATH"},
|
||||
Destination: &cfg.Asset.Path,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "jwt-secret",
|
||||
Value: "Pive-Fumkiu4",
|
||||
Value: flags.OverrideDefaultString(cfg.TokenManager.JWTSecret, "Pive-Fumkiu4"),
|
||||
Usage: "Used to create JWT to talk to reva, should equal reva's jwt-secret",
|
||||
EnvVars: []string{"ACCOUNTS_JWT_SECRET", "OCIS_JWT_SECRET"},
|
||||
Destination: &cfg.TokenManager.JWTSecret,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "storage-disk-path",
|
||||
Value: "",
|
||||
Value: flags.OverrideDefaultString(cfg.Repo.Disk.Path, ""),
|
||||
Usage: "Path on the local disk, e.g. /var/tmp/ocis/accounts",
|
||||
EnvVars: []string{"ACCOUNTS_STORAGE_DISK_PATH"},
|
||||
Destination: &cfg.Repo.Disk.Path,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "storage-cs3-provider-addr",
|
||||
Value: "localhost:9215",
|
||||
Value: flags.OverrideDefaultString(cfg.Repo.CS3.ProviderAddr, "localhost:9215"),
|
||||
Usage: "bind address for the metadata storage provider",
|
||||
EnvVars: []string{"ACCOUNTS_STORAGE_CS3_PROVIDER_ADDR"},
|
||||
Destination: &cfg.Repo.CS3.ProviderAddr,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "storage-cs3-data-url",
|
||||
Value: "http://localhost:9216",
|
||||
Value: flags.OverrideDefaultString(cfg.Repo.CS3.DataURL, "http://localhost:9216"),
|
||||
Usage: "http endpoint of the metadata storage",
|
||||
EnvVars: []string{"ACCOUNTS_STORAGE_CS3_DATA_URL"},
|
||||
Destination: &cfg.Repo.CS3.DataURL,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "storage-cs3-data-prefix",
|
||||
Value: "data",
|
||||
Value: flags.OverrideDefaultString(cfg.Repo.CS3.DataPrefix, "data"),
|
||||
Usage: "path prefix for the http endpoint of the metadata storage, without leading slash",
|
||||
EnvVars: []string{"ACCOUNTS_STORAGE_CS3_DATA_PREFIX"},
|
||||
Destination: &cfg.Repo.CS3.DataPrefix,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "storage-cs3-jwt-secret",
|
||||
Value: "Pive-Fumkiu4",
|
||||
Value: flags.OverrideDefaultString(cfg.Repo.CS3.JWTSecret, "Pive-Fumkiu4"),
|
||||
Usage: "Used to create JWT to talk to reva, should equal reva's jwt-secret",
|
||||
EnvVars: []string{"ACCOUNTS_STORAGE_CS3_JWT_SECRET", "OCIS_JWT_SECRET"},
|
||||
Destination: &cfg.Repo.CS3.JWTSecret,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "service-user-uuid",
|
||||
Value: "95cb8724-03b2-11eb-a0a6-c33ef8ef53ad",
|
||||
Value: flags.OverrideDefaultString(cfg.ServiceUser.UUID, "95cb8724-03b2-11eb-a0a6-c33ef8ef53ad"),
|
||||
Usage: "uuid of the internal service user (required on EOS)",
|
||||
EnvVars: []string{"ACCOUNTS_SERVICE_USER_UUID"},
|
||||
Destination: &cfg.ServiceUser.UUID,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "service-user-username",
|
||||
Value: "",
|
||||
Value: flags.OverrideDefaultString(cfg.ServiceUser.Username, ""),
|
||||
Usage: "username of the internal service user (required on EOS)",
|
||||
EnvVars: []string{"ACCOUNTS_SERVICE_USER_USERNAME"},
|
||||
Destination: &cfg.ServiceUser.Username,
|
||||
},
|
||||
&cli.Int64Flag{
|
||||
Name: "service-user-uid",
|
||||
Value: 0,
|
||||
Value: flags.OverrideDefaultInt64(cfg.ServiceUser.UID, 0),
|
||||
Usage: "uid of the internal service user (required on EOS)",
|
||||
EnvVars: []string{"ACCOUNTS_SERVICE_USER_UID"},
|
||||
Destination: &cfg.ServiceUser.UID,
|
||||
},
|
||||
&cli.Int64Flag{
|
||||
Name: "service-user-gid",
|
||||
Value: 0,
|
||||
Value: flags.OverrideDefaultInt64(cfg.ServiceUser.GID, 0),
|
||||
Usage: "gid of the internal service user (required on EOS)",
|
||||
EnvVars: []string{"ACCOUNTS_SERVICE_USER_GID"},
|
||||
Destination: &cfg.ServiceUser.GID,
|
||||
},
|
||||
&cli.Int64Flag{
|
||||
Name: "uid-index-lower-bound",
|
||||
Value: 0,
|
||||
Value: flags.OverrideDefaultInt64(cfg.Index.UID.Lower, 0),
|
||||
Usage: "define a starting point for the account UID",
|
||||
EnvVars: []string{"ACCOUNTS_UID_INDEX_LOWER_BOUND"},
|
||||
Destination: &cfg.Index.UID.Lower,
|
||||
},
|
||||
&cli.Int64Flag{
|
||||
Name: "gid-index-lower-bound",
|
||||
Value: 1000,
|
||||
Value: flags.OverrideDefaultInt64(cfg.Index.GID.Lower, 1000),
|
||||
Usage: "define a starting point for the account GID",
|
||||
EnvVars: []string{"ACCOUNTS_GID_INDEX_LOWER_BOUND"},
|
||||
Destination: &cfg.Index.GID.Lower,
|
||||
},
|
||||
&cli.Int64Flag{
|
||||
Name: "uid-index-upper-bound",
|
||||
Value: 0,
|
||||
Value: flags.OverrideDefaultInt64(cfg.Index.UID.Upper, 0),
|
||||
Usage: "define an ending point for the account UID",
|
||||
EnvVars: []string{"ACCOUNTS_UID_INDEX_UPPER_BOUND"},
|
||||
Destination: &cfg.Index.UID.Upper,
|
||||
},
|
||||
&cli.Int64Flag{
|
||||
Name: "gid-index-upper-bound",
|
||||
Value: 1000,
|
||||
Value: flags.OverrideDefaultInt64(cfg.Index.GID.Upper, 1000),
|
||||
Usage: "define an ending point for the account GID",
|
||||
EnvVars: []string{"ACCOUNTS_GID_INDEX_UPPER_BOUND"},
|
||||
Destination: &cfg.Index.GID.Upper,
|
||||
@@ -240,14 +241,14 @@ func UpdateAccountWithConfig(cfg *config.Config, a *accounts.Account) []cli.Flag
|
||||
return []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "grpc-namespace",
|
||||
Value: "com.owncloud.api",
|
||||
Value: flags.OverrideDefaultString(cfg.GRPC.Namespace, "com.owncloud.api"),
|
||||
Usage: "Set the base namespace for the grpc namespace",
|
||||
EnvVars: []string{"ACCOUNTS_GRPC_NAMESPACE"},
|
||||
Destination: &cfg.GRPC.Namespace,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "name",
|
||||
Value: "accounts",
|
||||
Value: flags.OverrideDefaultString(cfg.Server.Name, "accounts"),
|
||||
Usage: "service name",
|
||||
EnvVars: []string{"ACCOUNTS_NAME"},
|
||||
Destination: &cfg.Server.Name,
|
||||
@@ -324,14 +325,14 @@ func AddAccountWithConfig(cfg *config.Config, a *accounts.Account) []cli.Flag {
|
||||
return []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "grpc-namespace",
|
||||
Value: "com.owncloud.api",
|
||||
Value: flags.OverrideDefaultString(cfg.GRPC.Namespace, "com.owncloud.api"),
|
||||
Usage: "Set the base namespace for the grpc namespace",
|
||||
EnvVars: []string{"ACCOUNTS_GRPC_NAMESPACE"},
|
||||
Destination: &cfg.GRPC.Namespace,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "name",
|
||||
Value: "accounts",
|
||||
Value: flags.OverrideDefaultString(cfg.Server.Name, "accounts"),
|
||||
Usage: "service name",
|
||||
EnvVars: []string{"ACCOUNTS_NAME"},
|
||||
Destination: &cfg.Server.Name,
|
||||
@@ -408,14 +409,14 @@ func ListAccountsWithConfig(cfg *config.Config) []cli.Flag {
|
||||
return []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "grpc-namespace",
|
||||
Value: "com.owncloud.api",
|
||||
Value: flags.OverrideDefaultString(cfg.GRPC.Namespace, "com.owncloud.api"),
|
||||
Usage: "Set the base namespace for the grpc namespace",
|
||||
EnvVars: []string{"ACCOUNTS_GRPC_NAMESPACE"},
|
||||
Destination: &cfg.GRPC.Namespace,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "name",
|
||||
Value: "accounts",
|
||||
Value: flags.OverrideDefaultString(cfg.Server.Name, "accounts"),
|
||||
Usage: "service name",
|
||||
EnvVars: []string{"ACCOUNTS_NAME"},
|
||||
Destination: &cfg.Server.Name,
|
||||
@@ -428,14 +429,14 @@ func RemoveAccountWithConfig(cfg *config.Config) []cli.Flag {
|
||||
return []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "grpc-namespace",
|
||||
Value: "com.owncloud.api",
|
||||
Value: flags.OverrideDefaultString(cfg.GRPC.Namespace, "com.owncloud.api"),
|
||||
Usage: "Set the base namespace for the grpc namespace",
|
||||
EnvVars: []string{"ACCOUNTS_GRPC_NAMESPACE"},
|
||||
Destination: &cfg.GRPC.Namespace,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "name",
|
||||
Value: "accounts",
|
||||
Value: flags.OverrideDefaultString(cfg.Server.Name, "accounts"),
|
||||
Usage: "service name",
|
||||
EnvVars: []string{"ACCOUNTS_NAME"},
|
||||
Destination: &cfg.Server.Name,
|
||||
@@ -448,14 +449,14 @@ func InspectAccountWithConfig(cfg *config.Config) []cli.Flag {
|
||||
return []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "grpc-namespace",
|
||||
Value: "com.owncloud.api",
|
||||
Value: flags.OverrideDefaultString(cfg.GRPC.Namespace, "com.owncloud.api"),
|
||||
Usage: "Set the base namespace for the grpc namespace",
|
||||
EnvVars: []string{"ACCOUNTS_GRPC_NAMESPACE"},
|
||||
Destination: &cfg.GRPC.Namespace,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "name",
|
||||
Value: "accounts",
|
||||
Value: flags.OverrideDefaultString(cfg.Server.Name, "accounts"),
|
||||
Usage: "service name",
|
||||
EnvVars: []string{"ACCOUNTS_NAME"},
|
||||
Destination: &cfg.Server.Name,
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
package flags
|
||||
|
||||
// OverrideDefaultString checks whether the default value of v is the zero value, if so, ensure the flag has a correct
|
||||
// value by providing one. A value different than zero would mean that it was read from a config file either from an
|
||||
// extension or from a higher source (i.e: ocis command).
|
||||
func OverrideDefaultString(v, def string) string {
|
||||
if v != "" {
|
||||
return v
|
||||
}
|
||||
|
||||
return def
|
||||
}
|
||||
|
||||
// OverrideDefaultBool checks whether the default value of v is the zero value, if so, ensure the flag has a correct
|
||||
// value by providing one. A value different than zero would mean that it was read from a config file either from an
|
||||
// extension or from a higher source (i.e: ocis command).
|
||||
func OverrideDefaultBool(v, def bool) bool {
|
||||
if v != false {
|
||||
return v
|
||||
}
|
||||
|
||||
return def
|
||||
}
|
||||
|
||||
// OverrideDefaultInt checks whether the default value of v is the zero value, if so, ensure the flag has a correct
|
||||
// value by providing one. A value different than zero would mean that it was read from a config file either from an
|
||||
// extension or from a higher source (i.e: ocis command).
|
||||
func OverrideDefaultInt(v, def int) int {
|
||||
if v != 0 {
|
||||
return v
|
||||
}
|
||||
|
||||
return def
|
||||
}
|
||||
|
||||
// OverrideDefaultInt64 checks whether the default value of v is the zero value, if so, ensure the flag has a correct
|
||||
// value by providing one. A value different than zero would mean that it was read from a config file either from an
|
||||
// extension or from a higher source (i.e: ocis command).
|
||||
func OverrideDefaultInt64(v, def int64) int64 {
|
||||
if v != 0 {
|
||||
return v
|
||||
}
|
||||
|
||||
return def
|
||||
}
|
||||
@@ -27,6 +27,9 @@ func AccountsCommand(cfg *config.Config) *cli.Command {
|
||||
command.InspectAccount(cfg.Accounts),
|
||||
command.PrintVersion(cfg.Accounts),
|
||||
},
|
||||
Before: func(ctx *cli.Context) error {
|
||||
return ParseConfig(ctx, cfg)
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
origCmd := command.Server(configureAccounts(cfg))
|
||||
return handleOriginalAction(c, origCmd)
|
||||
|
||||
@@ -22,6 +22,9 @@ func ProxyCommand(cfg *config.Config) *cli.Command {
|
||||
Subcommands: []*cli.Command{
|
||||
command.PrintVersion(cfg.Proxy),
|
||||
},
|
||||
Before: func(ctx *cli.Context) error {
|
||||
return ParseConfig(ctx, cfg)
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
origCmd := command.Server(configureProxy(cfg))
|
||||
return handleOriginalAction(c, origCmd)
|
||||
|
||||
@@ -2,6 +2,7 @@ package flagset
|
||||
|
||||
import (
|
||||
"github.com/micro/cli/v2"
|
||||
"github.com/owncloud/ocis/ocis-pkg/flags"
|
||||
"github.com/owncloud/ocis/proxy/pkg/config"
|
||||
)
|
||||
|
||||
@@ -34,7 +35,7 @@ func HealthWithConfig(cfg *config.Config) []cli.Flag {
|
||||
return []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "debug-addr",
|
||||
Value: "0.0.0.0:9109",
|
||||
Value: flags.OverrideDefaultString(cfg.Debug.Addr, "0.0.0.0:9109"),
|
||||
Usage: "Address to debug endpoint",
|
||||
EnvVars: []string{"PROXY_DEBUG_ADDR"},
|
||||
Destination: &cfg.Debug.Addr,
|
||||
@@ -60,7 +61,7 @@ func ServerWithConfig(cfg *config.Config) []cli.Flag {
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "tracing-type",
|
||||
Value: "jaeger",
|
||||
Value: flags.OverrideDefaultString(cfg.Tracing.Type, "jaeger"),
|
||||
Usage: "Tracing backend type",
|
||||
EnvVars: []string{"PROXY_TRACING_TYPE"},
|
||||
Destination: &cfg.Tracing.Type,
|
||||
@@ -81,14 +82,14 @@ func ServerWithConfig(cfg *config.Config) []cli.Flag {
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "tracing-service",
|
||||
Value: "proxy",
|
||||
Value: flags.OverrideDefaultString(cfg.Tracing.Service, "proxy"),
|
||||
Usage: "Service name for tracing",
|
||||
EnvVars: []string{"PROXY_TRACING_SERVICE"},
|
||||
Destination: &cfg.Tracing.Service,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "debug-addr",
|
||||
Value: "0.0.0.0:9205",
|
||||
Value: flags.OverrideDefaultString(cfg.Debug.Addr, "0.0.0.0:9205"),
|
||||
Usage: "Address to bind debug server",
|
||||
EnvVars: []string{"PROXY_DEBUG_ADDR"},
|
||||
Destination: &cfg.Debug.Addr,
|
||||
@@ -114,77 +115,77 @@ func ServerWithConfig(cfg *config.Config) []cli.Flag {
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "http-addr",
|
||||
Value: "0.0.0.0:9200",
|
||||
Value: flags.OverrideDefaultString(cfg.HTTP.Addr, "0.0.0.0:9200"),
|
||||
Usage: "Address to bind http server",
|
||||
EnvVars: []string{"PROXY_HTTP_ADDR"},
|
||||
Destination: &cfg.HTTP.Addr,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "http-root",
|
||||
Value: "/",
|
||||
Value: flags.OverrideDefaultString(cfg.HTTP.Root, "/"),
|
||||
Usage: "Root path of http server",
|
||||
EnvVars: []string{"PROXY_HTTP_ROOT"},
|
||||
Destination: &cfg.HTTP.Root,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "asset-path",
|
||||
Value: "",
|
||||
Value: flags.OverrideDefaultString(cfg.Asset.Path, ""),
|
||||
Usage: "Path to custom assets",
|
||||
EnvVars: []string{"PROXY_ASSET_PATH"},
|
||||
Destination: &cfg.Asset.Path,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "service-namespace",
|
||||
Value: "com.owncloud.web",
|
||||
Value: flags.OverrideDefaultString(cfg.Service.Namespace, "com.owncloud.web"),
|
||||
Usage: "Set the base namespace for the service namespace",
|
||||
EnvVars: []string{"PROXY_SERVICE_NAMESPACE"},
|
||||
Destination: &cfg.Service.Namespace,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "service-name",
|
||||
Value: "proxy",
|
||||
Value: flags.OverrideDefaultString(cfg.Service.Name, "proxy"),
|
||||
Usage: "Service name",
|
||||
EnvVars: []string{"PROXY_SERVICE_NAME"},
|
||||
Destination: &cfg.Service.Name,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "transport-tls-cert",
|
||||
Value: "",
|
||||
Value: flags.OverrideDefaultString(cfg.HTTP.TLSCert, ""),
|
||||
Usage: "Certificate file for transport encryption",
|
||||
EnvVars: []string{"PROXY_TRANSPORT_TLS_CERT"},
|
||||
Destination: &cfg.HTTP.TLSCert,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "transport-tls-key",
|
||||
Value: "",
|
||||
Value: flags.OverrideDefaultString(cfg.HTTP.TLSKey, ""),
|
||||
Usage: "Secret file for transport encryption",
|
||||
EnvVars: []string{"PROXY_TRANSPORT_TLS_KEY"},
|
||||
Destination: &cfg.HTTP.TLSKey,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "tls",
|
||||
Value: flags.OverrideDefaultBool(cfg.HTTP.TLS, true),
|
||||
Usage: "Use TLS (disable only if proxy is behind a TLS-terminating reverse-proxy).",
|
||||
EnvVars: []string{"PROXY_TLS"},
|
||||
Value: true,
|
||||
Destination: &cfg.HTTP.TLS,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "jwt-secret",
|
||||
Value: "Pive-Fumkiu4",
|
||||
Value: flags.OverrideDefaultString(cfg.TokenManager.JWTSecret, "Pive-Fumkiu4"),
|
||||
Usage: "Used to create JWT to talk to reva, should equal reva's jwt-secret",
|
||||
EnvVars: []string{"PROXY_JWT_SECRET", "OCIS_JWT_SECRET"},
|
||||
Destination: &cfg.TokenManager.JWTSecret,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "reva-gateway-addr",
|
||||
Value: "127.0.0.1:9142",
|
||||
Value: flags.OverrideDefaultString(cfg.Reva.Address, "127.0.0.1:9142"),
|
||||
Usage: "REVA Gateway Endpoint",
|
||||
EnvVars: []string{"PROXY_REVA_GATEWAY_ADDR"},
|
||||
Destination: &cfg.Reva.Address,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "insecure",
|
||||
Value: false,
|
||||
Value: flags.OverrideDefaultBool(cfg.InsecureBackends, false),
|
||||
Usage: "allow insecure communication to upstream servers",
|
||||
EnvVars: []string{"PROXY_INSECURE_BACKENDS"},
|
||||
Destination: &cfg.InsecureBackends,
|
||||
@@ -194,28 +195,28 @@ func ServerWithConfig(cfg *config.Config) []cli.Flag {
|
||||
|
||||
&cli.StringFlag{
|
||||
Name: "oidc-issuer",
|
||||
Value: "https://localhost:9200",
|
||||
Value: flags.OverrideDefaultString(cfg.OIDC.Issuer, "https://localhost:9200"),
|
||||
Usage: "OIDC issuer",
|
||||
EnvVars: []string{"PROXY_OIDC_ISSUER", "OCIS_URL"}, // PROXY_OIDC_ISSUER takes precedence over OCIS_URL
|
||||
Destination: &cfg.OIDC.Issuer,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "oidc-insecure",
|
||||
Value: true,
|
||||
Value: flags.OverrideDefaultBool(cfg.OIDC.Insecure, true),
|
||||
Usage: "OIDC allow insecure communication",
|
||||
EnvVars: []string{"PROXY_OIDC_INSECURE"},
|
||||
Destination: &cfg.OIDC.Insecure,
|
||||
},
|
||||
&cli.IntFlag{
|
||||
Name: "oidc-userinfo-cache-tll",
|
||||
Value: 10,
|
||||
Value: flags.OverrideDefaultInt(cfg.OIDC.UserinfoCache.TTL, 10),
|
||||
Usage: "Fallback TTL in seconds for caching userinfo, when no token lifetime can be identified",
|
||||
EnvVars: []string{"PROXY_OIDC_USERINFO_CACHE_TTL"},
|
||||
Destination: &cfg.OIDC.UserinfoCache.TTL,
|
||||
},
|
||||
&cli.IntFlag{
|
||||
Name: "oidc-userinfo-cache-size",
|
||||
Value: 1024,
|
||||
Value: flags.OverrideDefaultInt(cfg.OIDC.UserinfoCache.Size, 1024),
|
||||
Usage: "Max entries for caching userinfo",
|
||||
EnvVars: []string{"PROXY_OIDC_USERINFO_CACHE_SIZE"},
|
||||
Destination: &cfg.OIDC.UserinfoCache.Size,
|
||||
@@ -223,7 +224,7 @@ func ServerWithConfig(cfg *config.Config) []cli.Flag {
|
||||
|
||||
&cli.BoolFlag{
|
||||
Name: "autoprovision-accounts",
|
||||
Value: false,
|
||||
Value: flags.OverrideDefaultBool(cfg.AutoprovisionAccounts, false),
|
||||
Usage: "create accounts from OIDC access tokens to learn new users",
|
||||
EnvVars: []string{"PROXY_AUTOPROVISION_ACCOUNTS"},
|
||||
Destination: &cfg.AutoprovisionAccounts,
|
||||
@@ -238,7 +239,7 @@ func ServerWithConfig(cfg *config.Config) []cli.Flag {
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "enable-presignedurls",
|
||||
Value: true,
|
||||
Value: flags.OverrideDefaultBool(cfg.PreSignedURL.Enabled, true),
|
||||
Usage: "Enable or disable handling the presigned urls in the proxy",
|
||||
EnvVars: []string{"PROXY_ENABLE_PRESIGNEDURLS"},
|
||||
Destination: &cfg.PreSignedURL.Enabled,
|
||||
@@ -247,7 +248,7 @@ func ServerWithConfig(cfg *config.Config) []cli.Flag {
|
||||
// Basic auth
|
||||
&cli.BoolFlag{
|
||||
Name: "enable-basic-auth",
|
||||
Value: false,
|
||||
Value: flags.OverrideDefaultBool(cfg.EnableBasicAuth, false),
|
||||
Usage: "enable basic authentication",
|
||||
EnvVars: []string{"PROXY_ENABLE_BASIC_AUTH"},
|
||||
Destination: &cfg.EnableBasicAuth,
|
||||
@@ -255,7 +256,7 @@ func ServerWithConfig(cfg *config.Config) []cli.Flag {
|
||||
|
||||
&cli.StringFlag{
|
||||
Name: "account-backend-type",
|
||||
Value: "accounts",
|
||||
Value: flags.OverrideDefaultString(cfg.AccountBackend, "accounts"),
|
||||
Usage: "account-backend-type",
|
||||
EnvVars: []string{"PROXY_ACCOUNT_BACKEND_TYPE"},
|
||||
Destination: &cfg.AccountBackend,
|
||||
@@ -275,14 +276,14 @@ func ListProxyWithConfig(cfg *config.Config) []cli.Flag {
|
||||
return []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "service-namespace",
|
||||
Value: "com.owncloud.web",
|
||||
Value: flags.OverrideDefaultString(cfg.OIDC.Issuer, "com.owncloud.web"),
|
||||
Usage: "Set the base namespace for the service namespace",
|
||||
EnvVars: []string{"PROXY_SERVICE_NAMESPACE"},
|
||||
Destination: &cfg.Service.Namespace,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "service-name",
|
||||
Value: "proxy",
|
||||
Value: flags.OverrideDefaultString(cfg.Service.Name, "proxy"),
|
||||
Usage: "Service name",
|
||||
EnvVars: []string{"PROXY_SERVICE_NAME"},
|
||||
Destination: &cfg.Service.Name,
|
||||
|
||||
Reference in New Issue
Block a user