mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-07-19 03:54:11 -04:00
Merge pull request #2708 from owncloud/try-gookikt-config
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -13,7 +13,6 @@ node_modules/
|
||||
ocis/ocis
|
||||
ocis/cmd/ocis/__debug_bin
|
||||
ocis/cmd/ocis/config/
|
||||
config/
|
||||
|
||||
.idea
|
||||
|
||||
|
||||
@@ -3,10 +3,12 @@ SKIP_CONFIG_DOCS_GENERATE ?= 0
|
||||
CONFIG_DOCS_BASE_PATH ?= ../docs/extensions
|
||||
|
||||
.PHONY: config-docs-generate
|
||||
config-docs-generate: $(FLAEX)
|
||||
@if [ $(SKIP_CONFIG_DOCS_GENERATE) -ne 1 ]; then \
|
||||
$(FLAEX) >| $(CONFIG_DOCS_BASE_PATH)/$(NAME)/configuration.md \
|
||||
; fi;
|
||||
config-docs-generate: #$(FLAEX)
|
||||
# since https://github.com/owncloud/ocis/pull/2708 flaex can no longer be used
|
||||
# TODO: how to document configuration
|
||||
# @if [ $(SKIP_CONFIG_DOCS_GENERATE) -ne 1 ]; then \
|
||||
# $(FLAEX) >| $(CONFIG_DOCS_BASE_PATH)/$(NAME)/configuration.md \
|
||||
# ; fi;
|
||||
|
||||
.PHONY: grpc-docs-generate
|
||||
grpc-docs-generate: buf-generate
|
||||
|
||||
4
.vscode/launch.json
vendored
4
.vscode/launch.json
vendored
@@ -20,6 +20,6 @@
|
||||
// set insecure options because we don't have valid certificates in dev environments
|
||||
"OCIS_INSECURE": "true",
|
||||
}
|
||||
},
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
if err := command.Execute(config.New()); err != nil {
|
||||
if err := command.Execute(config.DefaultConfig()); err != nil {
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,10 +5,11 @@ import (
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
"github.com/owncloud/ocis/accounts/pkg/flagset"
|
||||
|
||||
"github.com/asim/go-micro/plugins/client/grpc/v4"
|
||||
tw "github.com/olekukonko/tablewriter"
|
||||
"github.com/owncloud/ocis/accounts/pkg/config"
|
||||
"github.com/owncloud/ocis/accounts/pkg/flagset"
|
||||
accounts "github.com/owncloud/ocis/accounts/pkg/proto/v0"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
@@ -5,10 +5,11 @@ import (
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
"github.com/owncloud/ocis/accounts/pkg/flagset"
|
||||
|
||||
"github.com/asim/go-micro/plugins/client/grpc/v4"
|
||||
tw "github.com/olekukonko/tablewriter"
|
||||
"github.com/owncloud/ocis/accounts/pkg/config"
|
||||
"github.com/owncloud/ocis/accounts/pkg/flagset"
|
||||
accounts "github.com/owncloud/ocis/accounts/pkg/proto/v0"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
@@ -4,9 +4,10 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/owncloud/ocis/accounts/pkg/flagset"
|
||||
|
||||
"github.com/asim/go-micro/plugins/client/grpc/v4"
|
||||
"github.com/owncloud/ocis/accounts/pkg/config"
|
||||
"github.com/owncloud/ocis/accounts/pkg/flagset"
|
||||
accounts "github.com/owncloud/ocis/accounts/pkg/proto/v0"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
@@ -3,24 +3,16 @@ package command
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/shared"
|
||||
|
||||
"github.com/owncloud/ocis/accounts/pkg/config"
|
||||
"github.com/owncloud/ocis/accounts/pkg/flagset"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/log"
|
||||
"github.com/owncloud/ocis/ocis-pkg/sync"
|
||||
"github.com/owncloud/ocis/ocis-pkg/version"
|
||||
"github.com/spf13/viper"
|
||||
"github.com/thejerf/suture/v4"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
var (
|
||||
defaultConfigPaths = []string{"/etc/ocis", "$HOME/.ocis", "./config"}
|
||||
defaultFilename = "accounts"
|
||||
)
|
||||
|
||||
// Execute is the entry point for the ocis-accounts command.
|
||||
func Execute(cfg *config.Config) error {
|
||||
app := &cli.App{
|
||||
@@ -28,16 +20,12 @@ func Execute(cfg *config.Config) error {
|
||||
Version: version.String,
|
||||
Usage: "Provide accounts and groups for oCIS",
|
||||
Compiled: version.Compiled(),
|
||||
|
||||
Authors: []*cli.Author{
|
||||
{
|
||||
Name: "ownCloud GmbH",
|
||||
Email: "support@owncloud.com",
|
||||
},
|
||||
},
|
||||
|
||||
Flags: flagset.RootWithConfig(cfg),
|
||||
|
||||
Before: func(c *cli.Context) error {
|
||||
cfg.Server.Version = version.String
|
||||
return ParseConfig(c, cfg)
|
||||
@@ -68,60 +56,30 @@ func Execute(cfg *config.Config) error {
|
||||
return app.Run(os.Args)
|
||||
}
|
||||
|
||||
// NewLogger initializes a service-specific logger instance.
|
||||
func NewLogger(cfg *config.Config) log.Logger {
|
||||
return log.NewLogger(
|
||||
log.Name("accounts"),
|
||||
log.Level(cfg.Log.Level),
|
||||
log.Pretty(cfg.Log.Pretty),
|
||||
log.Color(cfg.Log.Color),
|
||||
log.File(cfg.Log.File),
|
||||
)
|
||||
}
|
||||
|
||||
// ParseConfig loads accounts configuration from Viper known paths.
|
||||
// ParseConfig loads accounts configuration from known paths.
|
||||
func ParseConfig(c *cli.Context, cfg *config.Config) error {
|
||||
sync.ParsingViperConfig.Lock()
|
||||
defer sync.ParsingViperConfig.Unlock()
|
||||
logger := NewLogger(cfg)
|
||||
conf, err := ociscfg.BindSourcesToStructs("accounts", cfg)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
|
||||
viper.SetEnvPrefix("ACCOUNTS")
|
||||
viper.AutomaticEnv()
|
||||
|
||||
if c.IsSet("config-file") {
|
||||
viper.SetConfigFile(c.String("config-file"))
|
||||
} else {
|
||||
viper.SetConfigName(defaultFilename)
|
||||
|
||||
for _, v := range defaultConfigPaths {
|
||||
viper.AddConfigPath(v)
|
||||
// provide with defaults for shared logging, since we need a valid destination address for BindEnv.
|
||||
if cfg.Log == nil && cfg.Commons != nil && cfg.Commons.Log != nil {
|
||||
cfg.Log = &shared.Log{
|
||||
Level: cfg.Commons.Log.Level,
|
||||
Pretty: cfg.Commons.Log.Pretty,
|
||||
Color: cfg.Commons.Log.Color,
|
||||
File: cfg.Commons.Log.File,
|
||||
}
|
||||
} else if cfg.Log == nil && cfg.Commons == nil {
|
||||
cfg.Log = &shared.Log{}
|
||||
}
|
||||
|
||||
if err := viper.ReadInConfig(); err != nil {
|
||||
switch err.(type) {
|
||||
case viper.ConfigFileNotFoundError:
|
||||
logger.Debug().
|
||||
Msg("no config found on preconfigured location")
|
||||
case viper.UnsupportedConfigError:
|
||||
logger.Fatal().
|
||||
Err(err).
|
||||
Msg("Unsupported config type")
|
||||
default:
|
||||
logger.Fatal().
|
||||
Err(err).
|
||||
Msg("Failed to read config")
|
||||
}
|
||||
}
|
||||
// load all env variables relevant to the config in the current context.
|
||||
conf.LoadOSEnv(config.GetEnv(cfg), false)
|
||||
|
||||
if err := viper.Unmarshal(&cfg); err != nil {
|
||||
logger.Fatal().
|
||||
Err(err).
|
||||
Msg("Failed to parse config")
|
||||
}
|
||||
|
||||
return nil
|
||||
bindings := config.StructMappings(cfg)
|
||||
return ociscfg.BindEnv(conf, bindings)
|
||||
}
|
||||
|
||||
// SutureService allows for the accounts command to be embedded and supervised by a suture supervisor tree.
|
||||
@@ -131,10 +89,7 @@ type SutureService struct {
|
||||
|
||||
// NewSutureService creates a new accounts.SutureService
|
||||
func NewSutureService(cfg *ociscfg.Config) suture.Service {
|
||||
if cfg.Mode == 0 {
|
||||
cfg.Accounts.Supervised = true
|
||||
}
|
||||
cfg.Accounts.Log.File = cfg.Log.File
|
||||
cfg.Accounts.Commons = cfg.Commons
|
||||
return SutureService{
|
||||
cfg: cfg.Accounts,
|
||||
}
|
||||
|
||||
@@ -4,11 +4,12 @@ import (
|
||||
"context"
|
||||
"strings"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/log"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/sync"
|
||||
|
||||
"github.com/oklog/run"
|
||||
"github.com/owncloud/ocis/accounts/pkg/config"
|
||||
"github.com/owncloud/ocis/accounts/pkg/flagset"
|
||||
"github.com/owncloud/ocis/accounts/pkg/metrics"
|
||||
"github.com/owncloud/ocis/accounts/pkg/server/grpc"
|
||||
"github.com/owncloud/ocis/accounts/pkg/server/http"
|
||||
@@ -23,34 +24,21 @@ func Server(cfg *config.Config) *cli.Command {
|
||||
Name: "server",
|
||||
Usage: "Start ocis accounts service",
|
||||
Description: "uses an LDAP server as the storage backend",
|
||||
Flags: flagset.ServerWithConfig(cfg),
|
||||
Before: func(ctx *cli.Context) error {
|
||||
logger := NewLogger(cfg)
|
||||
if cfg.HTTP.Root != "/" {
|
||||
cfg.HTTP.Root = strings.TrimSuffix(cfg.HTTP.Root, "/")
|
||||
}
|
||||
|
||||
cfg.Repo.Backend = strings.ToLower(cfg.Repo.Backend)
|
||||
|
||||
// When running on single binary mode the before hook from the root command won't get called. We manually
|
||||
// call this before hook from ocis command, so the configuration can be loaded.
|
||||
if !cfg.Supervised {
|
||||
return ParseConfig(ctx, cfg)
|
||||
if err := ParseConfig(ctx, cfg); err != nil {
|
||||
return err
|
||||
}
|
||||
if origins := ctx.StringSlice("cors-allowed-origins"); len(origins) != 0 {
|
||||
cfg.HTTP.CORS.AllowedOrigins = origins
|
||||
}
|
||||
if methods := ctx.StringSlice("cors-allowed-methods"); len(methods) != 0 {
|
||||
cfg.HTTP.CORS.AllowedMethods = methods
|
||||
}
|
||||
if headers := ctx.StringSlice("cors-allowed-headers"); len(headers) != 0 {
|
||||
cfg.HTTP.CORS.AllowedOrigins = headers
|
||||
}
|
||||
logger.Debug().Str("service", "accounts").Msg("ignoring config file parsing when running supervised")
|
||||
|
||||
return nil
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
logger := NewLogger(cfg)
|
||||
logger := log.LoggerFromConfig("accounts", *cfg.Log)
|
||||
err := tracing.Configure(cfg)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -4,9 +4,10 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/owncloud/ocis/accounts/pkg/flagset"
|
||||
|
||||
"github.com/asim/go-micro/plugins/client/grpc/v4"
|
||||
"github.com/owncloud/ocis/accounts/pkg/config"
|
||||
"github.com/owncloud/ocis/accounts/pkg/flagset"
|
||||
accounts "github.com/owncloud/ocis/accounts/pkg/proto/v0"
|
||||
"github.com/urfave/cli/v2"
|
||||
"google.golang.org/genproto/protobuf/field_mask"
|
||||
@@ -24,7 +25,6 @@ func UpdateAccount(cfg *config.Config) *cli.Command {
|
||||
Flags: flagset.UpdateAccountWithConfig(cfg, a),
|
||||
Before: func(c *cli.Context) error {
|
||||
if len(c.StringSlice("password_policies")) > 0 {
|
||||
// StringSliceFlag doesn't support Destination
|
||||
a.PasswordProfile.PasswordPolicies = c.StringSlice("password_policies")
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ import (
|
||||
|
||||
tw "github.com/olekukonko/tablewriter"
|
||||
"github.com/owncloud/ocis/accounts/pkg/config"
|
||||
"github.com/owncloud/ocis/accounts/pkg/flagset"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
@@ -17,7 +16,6 @@ func PrintVersion(cfg *config.Config) *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "version",
|
||||
Usage: "Print the versions of the running instances",
|
||||
Flags: flagset.ListAccountsWithConfig(cfg),
|
||||
Action: func(c *cli.Context) error {
|
||||
reg := registry.GetRegistry()
|
||||
services, err := reg.GetService(cfg.GRPC.Namespace + "." + cfg.Server.Name)
|
||||
|
||||
@@ -1,140 +1,143 @@
|
||||
// Package config should be moved to internal
|
||||
package config
|
||||
|
||||
import "context"
|
||||
import (
|
||||
"context"
|
||||
"path"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/shared"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/config/defaults"
|
||||
)
|
||||
|
||||
// LDAP defines the available ldap configuration.
|
||||
type LDAP struct {
|
||||
Hostname string
|
||||
Port int
|
||||
BaseDN string
|
||||
UserFilter string
|
||||
GroupFilter string
|
||||
BindDN string
|
||||
BindPassword string
|
||||
IDP string
|
||||
Schema LDAPSchema
|
||||
Hostname string `ocisConfig:"hostname"`
|
||||
Port int `ocisConfig:"port"`
|
||||
BaseDN string `ocisConfig:"base_dn"`
|
||||
UserFilter string `ocisConfig:"user_filter"`
|
||||
GroupFilter string `ocisConfig:"group_filter"`
|
||||
BindDN string `ocisConfig:"bind_dn"`
|
||||
BindPassword string `ocisConfig:"bind_password"`
|
||||
IDP string `ocisConfig:"idp"`
|
||||
Schema LDAPSchema `ocisConfig:"schema"`
|
||||
}
|
||||
|
||||
// LDAPSchema defines the available ldap schema configuration.
|
||||
type LDAPSchema struct {
|
||||
AccountID string
|
||||
Identities string
|
||||
Username string
|
||||
DisplayName string
|
||||
Mail string
|
||||
Groups string
|
||||
AccountID string `ocisConfig:"account_id"`
|
||||
Identities string `ocisConfig:"identities"`
|
||||
Username string `ocisConfig:"username"`
|
||||
DisplayName string `ocisConfig:"display_name"`
|
||||
Mail string `ocisConfig:"mail"`
|
||||
Groups string `ocisConfig:"groups"`
|
||||
}
|
||||
|
||||
// CORS defines the available cors configuration.
|
||||
type CORS struct {
|
||||
AllowedOrigins []string
|
||||
AllowedMethods []string
|
||||
AllowedHeaders []string
|
||||
AllowCredentials bool
|
||||
AllowedOrigins []string `ocisConfig:"allowed_origins"`
|
||||
AllowedMethods []string `ocisConfig:"allowed_methods"`
|
||||
AllowedHeaders []string `ocisConfig:"allowed_headers"`
|
||||
AllowCredentials bool `ocisConfig:"allowed_credentials"`
|
||||
}
|
||||
|
||||
// HTTP defines the available http configuration.
|
||||
type HTTP struct {
|
||||
Addr string
|
||||
Namespace string
|
||||
Root string
|
||||
CacheTTL int
|
||||
CORS CORS
|
||||
Addr string `ocisConfig:"addr"`
|
||||
Namespace string `ocisConfig:"namespace"`
|
||||
Root string `ocisConfig:"root"`
|
||||
CacheTTL int `ocisConfig:"cache_ttl"`
|
||||
CORS CORS `ocisConfig:"cors"`
|
||||
}
|
||||
|
||||
// GRPC defines the available grpc configuration.
|
||||
type GRPC struct {
|
||||
Addr string
|
||||
Namespace string
|
||||
Addr string `ocisConfig:"addr"`
|
||||
Namespace string `ocisConfig:"namespace"`
|
||||
}
|
||||
|
||||
// Server configures a server.
|
||||
type Server struct {
|
||||
Version string
|
||||
Name string
|
||||
HashDifficulty int
|
||||
DemoUsersAndGroups bool
|
||||
Version string `ocisConfig:"version"`
|
||||
Name string `ocisConfig:"name"`
|
||||
HashDifficulty int `ocisConfig:"hash_difficulty"`
|
||||
DemoUsersAndGroups bool `ocisConfig:"demo_users_and_groups"`
|
||||
}
|
||||
|
||||
// Asset defines the available asset configuration.
|
||||
type Asset struct {
|
||||
Path string
|
||||
Path string `ocisConfig:"path"`
|
||||
}
|
||||
|
||||
// TokenManager is the config for using the reva token manager
|
||||
type TokenManager struct {
|
||||
JWTSecret string
|
||||
}
|
||||
|
||||
// Log defines the available logging configuration.
|
||||
type Log struct {
|
||||
Level string
|
||||
Pretty bool
|
||||
Color bool
|
||||
File string
|
||||
JWTSecret string `ocisConfig:"jwt_secret"`
|
||||
}
|
||||
|
||||
// Repo defines which storage implementation is to be used.
|
||||
type Repo struct {
|
||||
Backend string
|
||||
Disk Disk
|
||||
CS3 CS3
|
||||
Backend string `ocisConfig:"backend"`
|
||||
Disk Disk `ocisConfig:"disk"`
|
||||
CS3 CS3 `ocisConfig:"cs3"`
|
||||
}
|
||||
|
||||
// Disk is the local disk implementation of the storage.
|
||||
type Disk struct {
|
||||
Path string
|
||||
Path string `ocisConfig:"path"`
|
||||
}
|
||||
|
||||
// CS3 is the cs3 implementation of the storage.
|
||||
type CS3 struct {
|
||||
ProviderAddr string
|
||||
DataURL string
|
||||
DataPrefix string
|
||||
JWTSecret string
|
||||
ProviderAddr string `ocisConfig:"provider_addr"`
|
||||
DataURL string `ocisConfig:"data_url"`
|
||||
DataPrefix string `ocisConfig:"data_prefix"`
|
||||
JWTSecret string `ocisConfig:"jwt_secret"`
|
||||
}
|
||||
|
||||
// ServiceUser defines the user required for EOS.
|
||||
type ServiceUser struct {
|
||||
UUID string
|
||||
Username string
|
||||
UID int64
|
||||
GID int64
|
||||
UUID string `ocisConfig:"uuid"`
|
||||
Username string `ocisConfig:"username"`
|
||||
UID int64 `ocisConfig:"uid"`
|
||||
GID int64 `ocisConfig:"gid"`
|
||||
}
|
||||
|
||||
// Index defines config for indexes.
|
||||
type Index struct {
|
||||
UID, GID Bound
|
||||
UID Bound `ocisConfig:"uid"`
|
||||
GID Bound `ocisConfig:"gid"`
|
||||
}
|
||||
|
||||
// Bound defines a lower and upper bound.
|
||||
type Bound struct {
|
||||
Lower, Upper int64
|
||||
Lower int64 `ocisConfig:"lower"`
|
||||
Upper int64 `ocisConfig:"upper"`
|
||||
}
|
||||
|
||||
// Tracing defines the available tracing configuration.
|
||||
type Tracing struct {
|
||||
Enabled bool
|
||||
Type string
|
||||
Endpoint string
|
||||
Collector string
|
||||
Service string
|
||||
Enabled bool `ocisConfig:"enabled"`
|
||||
Type string `ocisConfig:"type"`
|
||||
Endpoint string `ocisConfig:"endpoint"`
|
||||
Collector string `ocisConfig:"collector"`
|
||||
Service string `ocisConfig:"service"`
|
||||
}
|
||||
|
||||
// Config merges all Account config parameters.
|
||||
type Config struct {
|
||||
LDAP LDAP
|
||||
HTTP HTTP
|
||||
GRPC GRPC
|
||||
Server Server
|
||||
Asset Asset
|
||||
Log Log
|
||||
TokenManager TokenManager
|
||||
Repo Repo
|
||||
Index Index
|
||||
ServiceUser ServiceUser
|
||||
Tracing Tracing
|
||||
*shared.Commons
|
||||
|
||||
LDAP LDAP `ocisConfig:"ldap"`
|
||||
HTTP HTTP `ocisConfig:"http"`
|
||||
GRPC GRPC `ocisConfig:"grpc"`
|
||||
Server Server `ocisConfig:"server"`
|
||||
Asset Asset `ocisConfig:"asset"`
|
||||
Log *shared.Log `ocisConfig:"log"`
|
||||
TokenManager TokenManager `ocisConfig:"token_manager"`
|
||||
Repo Repo `ocisConfig:"repo"`
|
||||
Index Index `ocisConfig:"index"`
|
||||
ServiceUser ServiceUser `ocisConfig:"service_user"`
|
||||
Tracing Tracing `ocisConfig:"tracing"`
|
||||
|
||||
Context context.Context
|
||||
Supervised bool
|
||||
@@ -142,5 +145,81 @@ type Config struct {
|
||||
|
||||
// New returns a new config.
|
||||
func New() *Config {
|
||||
return &Config{}
|
||||
return &Config{
|
||||
Log: &shared.Log{},
|
||||
}
|
||||
}
|
||||
|
||||
func DefaultConfig() *Config {
|
||||
return &Config{
|
||||
LDAP: LDAP{},
|
||||
HTTP: HTTP{
|
||||
Addr: "127.0.0.1:9181",
|
||||
Namespace: "com.owncloud.web",
|
||||
Root: "/",
|
||||
CacheTTL: 604800, // 7 days
|
||||
CORS: CORS{
|
||||
AllowedOrigins: []string{"*"},
|
||||
AllowedMethods: []string{"GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"},
|
||||
AllowedHeaders: []string{"Authorization", "Origin", "Content-Type", "Accept", "X-Requested-With"},
|
||||
AllowCredentials: true,
|
||||
},
|
||||
},
|
||||
GRPC: GRPC{
|
||||
Addr: "127.0.0.1:9180",
|
||||
Namespace: "com.owncloud.api",
|
||||
},
|
||||
Server: Server{
|
||||
Name: "accounts",
|
||||
HashDifficulty: 11,
|
||||
DemoUsersAndGroups: true,
|
||||
},
|
||||
Asset: Asset{},
|
||||
TokenManager: TokenManager{
|
||||
JWTSecret: "Pive-Fumkiu4",
|
||||
},
|
||||
Repo: Repo{
|
||||
Backend: "CS3",
|
||||
Disk: Disk{
|
||||
Path: path.Join(defaults.BaseDataPath(), "accounts"),
|
||||
},
|
||||
CS3: CS3{
|
||||
ProviderAddr: "localhost:9215",
|
||||
DataURL: "http://localhost:9216",
|
||||
DataPrefix: "data",
|
||||
JWTSecret: "Pive-Fumkiu4",
|
||||
},
|
||||
},
|
||||
Index: Index{
|
||||
UID: Bound{
|
||||
Lower: 0,
|
||||
Upper: 1000,
|
||||
},
|
||||
GID: Bound{
|
||||
Lower: 0,
|
||||
Upper: 1000,
|
||||
},
|
||||
},
|
||||
ServiceUser: ServiceUser{
|
||||
UUID: "95cb8724-03b2-11eb-a0a6-c33ef8ef53ad",
|
||||
Username: "",
|
||||
UID: 0,
|
||||
GID: 0,
|
||||
},
|
||||
Tracing: Tracing{
|
||||
Type: "jaeger",
|
||||
Service: "accounts",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// GetEnv fetches a list of known env variables for this extension. It is to be used by gookit, as it provides a list
|
||||
// with all the environment variables an extension supports.
|
||||
func GetEnv(cfg *Config) []string {
|
||||
var r = make([]string, len(structMappings(cfg)))
|
||||
for i := range structMappings(cfg) {
|
||||
r = append(r, structMappings(cfg)[i].EnvVars...)
|
||||
}
|
||||
|
||||
return r
|
||||
}
|
||||
|
||||
148
accounts/pkg/config/mappings.go
Normal file
148
accounts/pkg/config/mappings.go
Normal file
@@ -0,0 +1,148 @@
|
||||
package config
|
||||
|
||||
import "github.com/owncloud/ocis/ocis-pkg/shared"
|
||||
|
||||
// StructMappings binds a set of environment variables to a destination on cfg. Iterating over this set and editing the
|
||||
// Destination value of a binding will alter the original value, as it is a pointer to its memory address. This lets
|
||||
// us propagate changes easier.
|
||||
func StructMappings(cfg *Config) []shared.EnvBinding {
|
||||
return structMappings(cfg)
|
||||
}
|
||||
|
||||
// structMappings binds a set of environment variables to a destination on cfg.
|
||||
func structMappings(cfg *Config) []shared.EnvBinding {
|
||||
return []shared.EnvBinding{
|
||||
{
|
||||
EnvVars: []string{"OCIS_LOG_FILE", "ACCOUNTS_LOG_FILE"},
|
||||
Destination: &cfg.Log.File,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_LOG_COLOR", "ACCOUNTS_LOG_COLOR"},
|
||||
Destination: &cfg.Log.Color,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_LOG_PRETTY", "ACCOUNTS_LOG_PRETTY"},
|
||||
Destination: &cfg.Log.Pretty,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_TRACING_ENABLED", "ACCOUNTS_TRACING_ENABLED"},
|
||||
Destination: &cfg.Tracing.Enabled,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_TRACING_TYPE", "ACCOUNTS_TRACING_TYPE"},
|
||||
Destination: &cfg.Tracing.Type,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_TRACING_ENDPOINT", "ACCOUNTS_TRACING_ENDPOINT"},
|
||||
Destination: &cfg.Tracing.Endpoint,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_TRACING_COLLECTOR", "ACCOUNTS_TRACING_COLLECTOR"},
|
||||
Destination: &cfg.Tracing.Collector,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"ACCOUNTS_TRACING_SERVICE"},
|
||||
Destination: &cfg.Tracing.Service,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"ACCOUNTS_HTTP_NAMESPACE"},
|
||||
Destination: &cfg.HTTP.Namespace,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"ACCOUNTS_HTTP_ADDR"},
|
||||
Destination: &cfg.HTTP.Addr,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"ACCOUNTS_HTTP_ROOT"},
|
||||
Destination: &cfg.HTTP.Root,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"ACCOUNTS_CACHE_TTL"},
|
||||
Destination: &cfg.HTTP.CacheTTL,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"ACCOUNTS_GRPC_NAMESPACE"},
|
||||
Destination: &cfg.GRPC.Namespace,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"ACCOUNTS_GRPC_ADDR"},
|
||||
Destination: &cfg.GRPC.Addr,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"ACCOUNTS_NAME"},
|
||||
Destination: &cfg.Server.Name,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"ACCOUNTS_HASH_DIFFICULTY"},
|
||||
Destination: &cfg.Server.HashDifficulty,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"ACCOUNTS_DEMO_USERS_AND_GROUPS"},
|
||||
Destination: &cfg.Server.DemoUsersAndGroups,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"ACCOUNTS_ASSET_PATH"},
|
||||
Destination: &cfg.Asset.Path,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_JWT_SECRET", "ACCOUNTS_JWT_SECRET"},
|
||||
Destination: &cfg.TokenManager.JWTSecret,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"ACCOUNTS_STORAGE_BACKEND"},
|
||||
Destination: &cfg.Repo.Backend,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"ACCOUNTS_STORAGE_DISK_PATH"},
|
||||
Destination: &cfg.Repo.Disk.Path,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"ACCOUNTS_STORAGE_CS3_PROVIDER_ADDR"},
|
||||
Destination: &cfg.Repo.CS3.ProviderAddr,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"ACCOUNTS_STORAGE_CS3_DATA_URL"},
|
||||
Destination: &cfg.Repo.CS3.DataURL,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"ACCOUNTS_STORAGE_CS3_DATA_PREFIX"},
|
||||
Destination: &cfg.Repo.CS3.DataPrefix,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_JWT_SECRET", "ACCOUNTS_STORAGE_CS3_JWT_SECRET"},
|
||||
Destination: &cfg.Repo.CS3.JWTSecret,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"ACCOUNTS_SERVICE_USER_UUID"},
|
||||
Destination: &cfg.ServiceUser.UUID,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"ACCOUNTS_SERVICE_USER_USERNAME"},
|
||||
Destination: &cfg.ServiceUser.Username,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"ACCOUNTS_SERVICE_USER_UID"},
|
||||
Destination: &cfg.ServiceUser.UID,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"ACCOUNTS_SERVICE_USER_GID"},
|
||||
Destination: &cfg.ServiceUser.GID,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"ACCOUNTS_UID_INDEX_LOWER_BOUND"},
|
||||
Destination: &cfg.Index.UID.Lower,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"ACCOUNTS_GID_INDEX_LOWER_BOUND"},
|
||||
Destination: &cfg.Index.GID.Lower,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"ACCOUNTS_UID_INDEX_UPPER_BOUND"},
|
||||
Destination: &cfg.Index.UID.Upper,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"ACCOUNTS_GID_INDEX_UPPER_BOUND"},
|
||||
Destination: &cfg.Index.GID.Upper,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -1,292 +1,12 @@
|
||||
package flagset
|
||||
|
||||
import (
|
||||
"path"
|
||||
|
||||
"github.com/owncloud/ocis/accounts/pkg/config"
|
||||
accounts "github.com/owncloud/ocis/accounts/pkg/proto/v0"
|
||||
"github.com/owncloud/ocis/ocis-pkg/config/defaults"
|
||||
"github.com/owncloud/ocis/ocis-pkg/flags"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
// RootWithConfig applies cfg to the root flagset
|
||||
func RootWithConfig(cfg *config.Config) []cli.Flag {
|
||||
return []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "log-level",
|
||||
Usage: "Set logging level",
|
||||
EnvVars: []string{"ACCOUNTS_LOG_LEVEL", "OCIS_LOG_LEVEL"},
|
||||
Destination: &cfg.Log.Level,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "log-pretty",
|
||||
Usage: "Enable pretty logging",
|
||||
EnvVars: []string{"ACCOUNTS_LOG_PRETTY", "OCIS_LOG_PRETTY"},
|
||||
Destination: &cfg.Log.Pretty,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "log-color",
|
||||
Usage: "Enable colored logging",
|
||||
EnvVars: []string{"ACCOUNTS_LOG_COLOR", "OCIS_LOG_COLOR"},
|
||||
Destination: &cfg.Log.Color,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "extensions",
|
||||
Usage: "Run specific extensions during supervised mode",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// ServerWithConfig applies cfg to the root flagset
|
||||
func ServerWithConfig(cfg *config.Config) []cli.Flag {
|
||||
return []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "log-file",
|
||||
Usage: "Enable log to file",
|
||||
EnvVars: []string{"ACCOUNTS_LOG_FILE", "OCIS_LOG_FILE"},
|
||||
Destination: &cfg.Log.File,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "tracing-enabled",
|
||||
Usage: "Enable sending traces",
|
||||
EnvVars: []string{"ACCOUNTS_TRACING_ENABLED", "OCIS_TRACING_ENABLED"},
|
||||
Destination: &cfg.Tracing.Enabled,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "tracing-type",
|
||||
Value: flags.OverrideDefaultString(cfg.Tracing.Type, "jaeger"),
|
||||
Usage: "Tracing backend type",
|
||||
EnvVars: []string{"ACCOUNTS_TRACING_TYPE", "OCIS_TRACING_TYPE"},
|
||||
Destination: &cfg.Tracing.Type,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "tracing-endpoint",
|
||||
Value: flags.OverrideDefaultString(cfg.Tracing.Endpoint, ""),
|
||||
Usage: "Endpoint for the agent",
|
||||
EnvVars: []string{"ACCOUNTS_TRACING_ENDPOINT", "OCIS_TRACING_ENDPOINT"},
|
||||
Destination: &cfg.Tracing.Endpoint,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "tracing-collector",
|
||||
Value: flags.OverrideDefaultString(cfg.Tracing.Collector, ""),
|
||||
Usage: "Endpoint for the collector",
|
||||
EnvVars: []string{"ACCOUNTS_TRACING_COLLECTOR", "OCIS_TRACING_COLLECTOR"},
|
||||
Destination: &cfg.Tracing.Collector,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "tracing-service",
|
||||
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: 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: flags.OverrideDefaultString(cfg.HTTP.Addr, "127.0.0.1:9181"),
|
||||
Usage: "Address to bind http server",
|
||||
EnvVars: []string{"ACCOUNTS_HTTP_ADDR"},
|
||||
Destination: &cfg.HTTP.Addr,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "http-root",
|
||||
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: 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.StringSliceFlag{
|
||||
Name: "cors-allowed-origins",
|
||||
Value: cli.NewStringSlice("*"),
|
||||
Usage: "Set the allowed CORS origins",
|
||||
EnvVars: []string{"ACCOUNTS_CORS_ALLOW_ORIGINS", "OCIS_CORS_ALLOW_ORIGINS"},
|
||||
},
|
||||
&cli.StringSliceFlag{
|
||||
Name: "cors-allowed-methods",
|
||||
Value: cli.NewStringSlice("GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"),
|
||||
Usage: "Set the allowed CORS origins",
|
||||
EnvVars: []string{"ACCOUNTS_CORS_ALLOW_METHODS", "OCIS_CORS_ALLOW_METHODS"},
|
||||
},
|
||||
&cli.StringSliceFlag{
|
||||
Name: "cors-allowed-headers",
|
||||
Value: cli.NewStringSlice("Authorization", "Origin", "Content-Type", "Accept", "X-Requested-With"),
|
||||
Usage: "Set the allowed CORS origins",
|
||||
EnvVars: []string{"ACCOUNTS_CORS_ALLOW_HEADERS", "OCIS_CORS_ALLOW_HEADERS"},
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "cors-allow-credentials",
|
||||
Value: flags.OverrideDefaultBool(cfg.HTTP.CORS.AllowCredentials, true),
|
||||
Usage: "Allow credentials for CORS",
|
||||
EnvVars: []string{"ACCOUNTS_CORS_ALLOW_CREDENTIALS", "OCIS_CORS_ALLOW_CREDENTIALS"},
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "grpc-namespace",
|
||||
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: flags.OverrideDefaultString(cfg.GRPC.Addr, "127.0.0.1:9180"),
|
||||
Usage: "Address to bind grpc server",
|
||||
EnvVars: []string{"ACCOUNTS_GRPC_ADDR"},
|
||||
Destination: &cfg.GRPC.Addr,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "name",
|
||||
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: flags.OverrideDefaultInt(cfg.Server.HashDifficulty, 11),
|
||||
Usage: "accounts password hash difficulty",
|
||||
EnvVars: []string{"ACCOUNTS_HASH_DIFFICULTY"},
|
||||
Destination: &cfg.Server.HashDifficulty,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "demo-users-and-groups",
|
||||
Value: flags.OverrideDefaultBool(cfg.Server.DemoUsersAndGroups, true),
|
||||
Usage: "Enable demo users and groups",
|
||||
EnvVars: []string{"ACCOUNTS_DEMO_USERS_AND_GROUPS"},
|
||||
Destination: &cfg.Server.DemoUsersAndGroups,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "asset-path",
|
||||
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: 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-backend",
|
||||
Value: flags.OverrideDefaultString(cfg.Repo.Backend, "CS3"),
|
||||
Usage: "Which backend to use to store accounts data (CS3 or disk)",
|
||||
EnvVars: []string{"ACCOUNTS_STORAGE_BACKEND"},
|
||||
Destination: &cfg.Repo.Backend,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "storage-disk-path",
|
||||
Value: flags.OverrideDefaultString(cfg.Repo.Disk.Path, path.Join(defaults.BaseDataPath(), "accounts")),
|
||||
Usage: "Path on the local disk to store accounts data when backend is set to disk",
|
||||
EnvVars: []string{"ACCOUNTS_STORAGE_DISK_PATH"},
|
||||
Destination: &cfg.Repo.Disk.Path,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "storage-cs3-provider-addr",
|
||||
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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "extensions",
|
||||
Usage: "Run specific extensions during supervised mode",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// UpdateAccountWithConfig applies update command flags to cfg
|
||||
func UpdateAccountWithConfig(cfg *config.Config, a *accounts.Account) []cli.Flag {
|
||||
if a.PasswordProfile == nil {
|
||||
|
||||
@@ -12,11 +12,10 @@ import (
|
||||
|
||||
mgrpcc "github.com/asim/go-micro/plugins/client/grpc/v4"
|
||||
empty "github.com/golang/protobuf/ptypes/empty"
|
||||
|
||||
"github.com/owncloud/ocis/accounts/pkg/command"
|
||||
"github.com/owncloud/ocis/accounts/pkg/config"
|
||||
"github.com/owncloud/ocis/accounts/pkg/proto/v0"
|
||||
svc "github.com/owncloud/ocis/accounts/pkg/service/v0"
|
||||
oclog "github.com/owncloud/ocis/ocis-pkg/log"
|
||||
"github.com/owncloud/ocis/ocis-pkg/service/grpc"
|
||||
settings "github.com/owncloud/ocis/settings/pkg/proto/v0"
|
||||
"github.com/stretchr/testify/assert"
|
||||
@@ -86,7 +85,7 @@ func init() {
|
||||
var hdlr *svc.Service
|
||||
var err error
|
||||
|
||||
if hdlr, err = svc.New(svc.Logger(command.NewLogger(cfg)), svc.Config(cfg), svc.RoleService(buildRoleServiceMock())); err != nil {
|
||||
if hdlr, err = svc.New(svc.Logger(oclog.LoggerFromConfig("accounts", *cfg.Log)), svc.Config(cfg), svc.RoleService(buildRoleServiceMock())); err != nil {
|
||||
log.Fatalf("Could not create new service")
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/shared"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/service/grpc"
|
||||
@@ -109,6 +111,10 @@ func (s Service) buildIndex() (*indexer.Indexer, error) {
|
||||
func configFromSvc(cfg *config.Config) (*idxcfg.Config, error) {
|
||||
c := idxcfg.New()
|
||||
|
||||
if cfg.Log == nil {
|
||||
cfg.Log = &shared.Log{}
|
||||
}
|
||||
|
||||
defer func(cfg *config.Config) {
|
||||
l := log.NewLogger(log.Color(cfg.Log.Color), log.Pretty(cfg.Log.Pretty), log.Level(cfg.Log.Level))
|
||||
if r := recover(); r != nil {
|
||||
|
||||
7
changelog/unreleased/revamp-config.md
Normal file
7
changelog/unreleased/revamp-config.md
Normal file
@@ -0,0 +1,7 @@
|
||||
Change: Restructure Configuration Parsing
|
||||
|
||||
Tags: ocis
|
||||
|
||||
CLI flags are no longer needed for subcommands, as we rely solely on env variables and config files. This greatly simplifies configuration and deployment.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/2708
|
||||
@@ -3,7 +3,6 @@
|
||||
set -e
|
||||
|
||||
mkdir -p /var/tmp/ocis/.config/
|
||||
cp /config/proxy-config.json /var/tmp/ocis/.config/proxy-config.json
|
||||
cp /config/web-config.dist.json /var/tmp/ocis/.config/web-config.json
|
||||
sed -i 's/ocis.owncloud.test/'${OCIS_DOMAIN:-ocis.owncloud.test}'/g' /var/tmp/ocis/.config/web-config.json
|
||||
|
||||
@@ -15,8 +14,4 @@ ocis kill accounts
|
||||
# stop builtin LDAP server since we use external LDAP only
|
||||
ocis kill glauth
|
||||
|
||||
ocis kill proxy
|
||||
sleep 10
|
||||
ocis proxy server # workaround for loading proxy configuration
|
||||
|
||||
wait # wait for oCIS to exit
|
||||
|
||||
@@ -75,8 +75,6 @@ services:
|
||||
STORAGE_LDAP_GROUPFILTER: '(&(objectclass=groupOfUniqueNames)(objectclass=owncloud)(ownclouduuid={{.OpaqueId}}*))'
|
||||
# web ui
|
||||
WEB_UI_CONFIG: "/var/tmp/ocis/.config/web-config.json"
|
||||
# proxy
|
||||
PROXY_CONFIG_FILE: "/var/tmp/ocis/.config/proxy-config.json"
|
||||
# General oCIS config
|
||||
OCIS_URL: https://${OCIS_DOMAIN:-ocis.owncloud.test}
|
||||
OCIS_DOMAIN: ${OCIS_DOMAIN:-ocis.owncloud.test}
|
||||
@@ -91,7 +89,7 @@ services:
|
||||
volumes:
|
||||
- ./config/ocis/entrypoint-override.sh:/entrypoint-override.sh
|
||||
- ./config/ocis/web-config.dist.json:/config/web-config.dist.json
|
||||
- ./config/ocis/proxy-config.json:/config/proxy-config.json
|
||||
- ./config/ocis/proxy.json:/etc/ocis/proxy.json
|
||||
- ocis-data:/var/lib/ocis
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
mkdir -p /var/tmp/ocis/.config/
|
||||
cp /config/proxy-config.dist.json /var/tmp/ocis/.config/proxy-config.json
|
||||
# TODO: remove replace logic when log level configuration is fixed
|
||||
sed -i 's/PROXY_LOG_LEVEL/${PROXY_LOG_LEVEL}/g' /var/tmp/ocis/.config/proxy-config.json
|
||||
|
||||
ocis server &
|
||||
sleep 10
|
||||
|
||||
@@ -14,9 +8,4 @@ ocis kill idp
|
||||
ocis kill glauth
|
||||
ocis kill accounts
|
||||
|
||||
# workaround for loading proxy configuration
|
||||
ocis kill proxy
|
||||
sleep 10
|
||||
ocis proxy server &
|
||||
|
||||
wait
|
||||
|
||||
@@ -106,4 +106,4 @@
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -108,7 +108,6 @@ services:
|
||||
OCIS_STORAGE_READ_ONLY: "false" # TODO: conflict with OWNCLOUDSQL -> https://github.com/owncloud/ocis/issues/2303
|
||||
# General oCIS config
|
||||
OCIS_LOG_LEVEL: ${OCIS_LOG_LEVEL:-error} # make oCIS less verbose
|
||||
PROXY_LOG_LEVEL: ${PROXY_LOG_LEVEL:-error}
|
||||
OCIS_URL: https://${CLOUD_DOMAIN:-cloud.owncloud.test}
|
||||
PROXY_TLS: "false" # do not use SSL between Traefik and oCIS
|
||||
PROXY_CONFIG_FILE: "/var/tmp/ocis/.config/proxy-config.json"
|
||||
@@ -120,7 +119,7 @@ services:
|
||||
OCIS_INSECURE: "${INSECURE:-false}"
|
||||
volumes:
|
||||
- ./config/ocis/entrypoint-override.sh:/entrypoint-override.sh
|
||||
- ./config/ocis/proxy-config.dist.json:/config/proxy-config.dist.json
|
||||
- ./config/ocis/proxy.json:/etc/ocis/proxy.json
|
||||
- ocis-data:/var/lib/ocis
|
||||
# shared volume with oC10
|
||||
- oc10-data:/mnt/data
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
set -e
|
||||
|
||||
mkdir -p /var/tmp/ocis/.config/
|
||||
cp /config/proxy-config.json /var/tmp/ocis/.config/proxy-config.json
|
||||
cp /config/web-config.dist.json /var/tmp/ocis/.config/web-config.json
|
||||
sed -i 's/ocis.owncloud.test/'${OCIS_DOMAIN:-ocis.owncloud.test}'/g' /var/tmp/ocis/.config/web-config.json
|
||||
|
||||
@@ -26,8 +25,4 @@ ocis accounts update --password $STORAGE_LDAP_BIND_PASSWORD $REVA_USER_UUID
|
||||
echo "default secrets changed"
|
||||
echo "##################################################"
|
||||
|
||||
ocis kill proxy
|
||||
sleep 10
|
||||
ocis proxy server # workaround for loading proxy configuration
|
||||
|
||||
wait # wait for oCIS to exit
|
||||
|
||||
@@ -62,8 +62,6 @@ services:
|
||||
OCIS_MACHINE_AUTH_API_KEY: ${OCIS_MACHINE_AUTH_API_KEY:-change-me-please}
|
||||
# web ui
|
||||
WEB_UI_CONFIG: "/var/tmp/ocis/.config/web-config.json"
|
||||
# proxy
|
||||
PROXY_CONFIG_FILE: "/var/tmp/ocis/.config/proxy-config.json"
|
||||
# make settings service available to oCIS Hello
|
||||
SETTINGS_GRPC_ADDR: 0.0.0.0:9191
|
||||
# INSECURE: needed if oCIS / Traefik is using self generated certificates
|
||||
@@ -71,7 +69,7 @@ services:
|
||||
volumes:
|
||||
- ./config/ocis/entrypoint-override.sh:/entrypoint-override.sh
|
||||
- ./config/ocis/web-config.dist.json:/config/web-config.dist.json
|
||||
- ./config/ocis/proxy-config.json:/config/proxy-config.json
|
||||
- ./config/ocis/proxy.json:/etc/ocis/proxy.json
|
||||
- ocis-data:/var/lib/ocis
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
|
||||
173
docs/ocis/config.md
Normal file
173
docs/ocis/config.md
Normal file
@@ -0,0 +1,173 @@
|
||||
---
|
||||
title: "Configuration"
|
||||
date: "2021-11-09T00:03:16+0100"
|
||||
weight: 2
|
||||
geekdocRepo: https://github.com/owncloud/ocis
|
||||
geekdocEditPath: edit/master/ocis/templates
|
||||
geekdocFilePath: config.md
|
||||
---
|
||||
|
||||
{{< toc >}}
|
||||
|
||||
## Configuration Framework
|
||||
|
||||
In order to simplify deployments and development the configuration model from oCIS aims to be simple yet flexible.
|
||||
|
||||
## Overview of the approach
|
||||
|
||||
{{< svg src="ocis/static/ocis-config-redesign.drawio.svg" >}}
|
||||
|
||||
## In-depth configuration
|
||||
|
||||
Since we include a set of predefined extensions within the single binary, configuring an extension can be done in a variety of ways. Since we work with complex types, having as many cli per config value scales poorly, so we limited the options to config files and environment variables, leaving cli flags for common values, such as logging (`--log-level`, `--log-pretty`, `--log-file` or `--log-color`).
|
||||
|
||||
The hierarchy is clear enough, leaving us with:
|
||||
|
||||
_(each element above overwrites its precedent)_
|
||||
|
||||
1. env variables
|
||||
2. extension config
|
||||
3. ocis config
|
||||
|
||||
This is manifested in the previous diagram. We can then speak about "configuration file arithmetics", where resulting config transformations happen through a series of steps. An administrator must be aware of these sources, since mis-managing them can be a source of confusion, having undesired transformations on config files believed not to be applied.
|
||||
|
||||
## Flows
|
||||
|
||||
Let's explore the various flows with examples and workflows.
|
||||
|
||||
### Examples
|
||||
|
||||
Let's explore with examples this approach.
|
||||
|
||||
#### Expected loading locations:
|
||||
|
||||
- `$HOME/.ocis/config/`
|
||||
- `/etc/ocis/`
|
||||
- `.config/`
|
||||
|
||||
followed by the extension name. When configuring the proxy, a valid full path that will get loaded is `$HOME/.ocis/config/proxy.yaml`.
|
||||
|
||||
#### Only config files
|
||||
|
||||
The following config files are present in the default loading locations:
|
||||
|
||||
_ocis.yaml_
|
||||
```yaml
|
||||
proxy:
|
||||
http:
|
||||
addr: localhost:1111
|
||||
log:
|
||||
pretty: false
|
||||
color: false
|
||||
level: info
|
||||
accounts:
|
||||
http:
|
||||
addr: localhost:2222
|
||||
log:
|
||||
level: debug
|
||||
color: false
|
||||
pretty: false
|
||||
log:
|
||||
pretty: true
|
||||
color: true
|
||||
level: info
|
||||
```
|
||||
|
||||
_proxy.yaml_
|
||||
```yaml
|
||||
http:
|
||||
addr: localhost:3333
|
||||
```
|
||||
|
||||
_accounts.yaml_
|
||||
```yaml
|
||||
http:
|
||||
addr: localhost:4444
|
||||
```
|
||||
|
||||
Note that the extension files will overwrite values from the main `ocis.yaml`, causing `ocis server` to run with the following configuration:
|
||||
|
||||
```yaml
|
||||
proxy:
|
||||
http:
|
||||
addr: localhost:3333
|
||||
accounts:
|
||||
http:
|
||||
addr: localhost:4444
|
||||
log:
|
||||
pretty: true
|
||||
color: true
|
||||
level: info
|
||||
```
|
||||
|
||||
#### Using ENV variables
|
||||
|
||||
The logging configuration if defined in the main ocis.yaml is inherited by all extensions. It can be, however, overwritten by a single extension file if desired. The same example can be used to demonstrate environment values overwrites. With the same set of config files now we have the following command `PROXY_HTTP_ADDR=localhost:5555 ocis server`, now the resulting config looks like:
|
||||
|
||||
```yaml
|
||||
proxy:
|
||||
http:
|
||||
addr: localhost:5555
|
||||
accounts:
|
||||
http:
|
||||
addr: localhost:4444
|
||||
log:
|
||||
pretty: true
|
||||
color: true
|
||||
level: info
|
||||
```
|
||||
|
||||
### Workflows
|
||||
|
||||
Since one can run an extension using the runtime (supervised) or not (unsupervised), we ensure correct behavior in both modes, expecting the same outputs.
|
||||
|
||||
#### Supervised
|
||||
|
||||
You are using the supervised mode whenever you issue the `ocis server` command. We start the runtime on port `9250` (by default) that listens for commands regarding the lifecycle of the supervised extensions. When an extension runs supervised and is killed, the only way to provide / overwrite configuration values will be through an extension config file. This is due to the parent process has already started, and it already has its own environment.
|
||||
|
||||
#### Unsupervised
|
||||
|
||||
All the points from the priority section hold true. An unsupervised extension can be started with the format: `ocis [extension]` i.e: `ocis proxy`. First, `ocis.yaml` is parsed, then `proxy.yaml` followed by environment variables.
|
||||
|
||||
## Shared Values
|
||||
|
||||
When running in supervised mode (`ocis server`) it is beneficial to have common values for logging, so that the log output is correctly formatted, or everything is piped to the same file without duplicating config keys and values all over the place. This is possible using the global `log` config key:
|
||||
|
||||
_ocis.yaml_
|
||||
```yaml
|
||||
log:
|
||||
level: error
|
||||
color: true
|
||||
pretty: true
|
||||
file: /var/tmp/ocis_output.log
|
||||
```
|
||||
|
||||
There is, however, the option for extensions to overwrite this global values by declaring their own logging directives:
|
||||
|
||||
_ocis.yaml_
|
||||
```yaml
|
||||
log:
|
||||
level: info
|
||||
color: false
|
||||
pretty: false
|
||||
```
|
||||
|
||||
One can go as far as to make the case of an extension overwriting its shared logging config that received from the main `ocis.yaml` file. Because things can get out of hands pretty fast we recommend not mixing logging configuration values and either use the same global logging values for all extensions.
|
||||
|
||||
{{< hint warning >}}
|
||||
When overwriting a globally shared logging values, one *MUST* specify all values.
|
||||
{{< /hint >}}
|
||||
|
||||
### Log config keys
|
||||
|
||||
```yaml
|
||||
log:
|
||||
level: [ error | warning | info | debug ]
|
||||
color: [ true | false ]
|
||||
pretty: [ true | false ]
|
||||
file: [ path/to/log/file ] # MUST not be used with pretty = true
|
||||
```
|
||||
|
||||
## Default config values (in yaml)
|
||||
|
||||
TBD. Needs to be generated and merged with the env mappings.
|
||||
@@ -53,7 +53,7 @@ PROXY_TRANSPORT_TLS_CERT=./certs/your-host.crt \
|
||||
|
||||
If you generated these certificates on your own, you might need to set `OCIS_INSECURE` to `true`.
|
||||
|
||||
For more configuration options check the configuration section in [oCIS]({{< ref "../configuration" >}}) and the oCIS extensions.
|
||||
For more configuration options check the configuration section in [oCIS]({{< ref "../config" >}}) and the oCIS extensions.
|
||||
|
||||
## Start the oCIS fullstack server with Docker Compose
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ Open [https://localhost:9200](https://localhost:9200) and [login using one of th
|
||||
|
||||
### Basic Management Commands
|
||||
|
||||
The oCIS single binary contains multiple extensions and the `ocis` command helps you to manage them. You already used `ocis server` to run all available extensions in the [Run oCIS]({{< ref "#run-ocis" >}}) section. We now will show you some more management commands, which you may also explore by typing `ocis --help` or going to the [docs]({{< ref "../configuration" >}}).
|
||||
The oCIS single binary contains multiple extensions and the `ocis` command helps you to manage them. You already used `ocis server` to run all available extensions in the [Run oCIS]({{< ref "#run-ocis" >}}) section. We now will show you some more management commands, which you may also explore by typing `ocis --help` or going to the [docs]({{< ref "../config" >}}).
|
||||
|
||||
To start oCIS server:
|
||||
|
||||
|
||||
4
docs/ocis/static/ocis-config-redesign.drawio.svg
Normal file
4
docs/ocis/static/ocis-config-redesign.drawio.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 22 KiB |
@@ -5,7 +5,6 @@ import (
|
||||
"net/http"
|
||||
|
||||
"github.com/owncloud/ocis/glauth/pkg/config"
|
||||
"github.com/owncloud/ocis/glauth/pkg/flagset"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
@@ -14,7 +13,9 @@ func Health(cfg *config.Config) *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "health",
|
||||
Usage: "Check health status",
|
||||
Flags: flagset.HealthWithConfig(cfg),
|
||||
Before: func(c *cli.Context) error {
|
||||
return ParseConfig(c, cfg)
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
logger := NewLogger(cfg)
|
||||
|
||||
|
||||
@@ -3,15 +3,13 @@ package command
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/owncloud/ocis/glauth/pkg/config"
|
||||
"github.com/owncloud/ocis/glauth/pkg/flagset"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/log"
|
||||
"github.com/owncloud/ocis/ocis-pkg/sync"
|
||||
oclog "github.com/owncloud/ocis/ocis-pkg/log"
|
||||
"github.com/owncloud/ocis/ocis-pkg/shared"
|
||||
"github.com/owncloud/ocis/ocis-pkg/version"
|
||||
"github.com/spf13/viper"
|
||||
"github.com/thejerf/suture/v4"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
@@ -23,21 +21,16 @@ func Execute(cfg *config.Config) error {
|
||||
Version: version.String,
|
||||
Usage: "Serve GLAuth API for oCIS",
|
||||
Compiled: version.Compiled(),
|
||||
|
||||
Authors: []*cli.Author{
|
||||
{
|
||||
Name: "ownCloud GmbH",
|
||||
Email: "support@owncloud.com",
|
||||
},
|
||||
},
|
||||
|
||||
Flags: flagset.RootWithConfig(cfg),
|
||||
|
||||
Before: func(c *cli.Context) error {
|
||||
cfg.Version = version.String
|
||||
return nil
|
||||
},
|
||||
|
||||
Commands: []*cli.Command{
|
||||
Server(cfg),
|
||||
Health(cfg),
|
||||
@@ -59,58 +52,32 @@ func Execute(cfg *config.Config) error {
|
||||
|
||||
// NewLogger initializes a service-specific logger instance.
|
||||
func NewLogger(cfg *config.Config) log.Logger {
|
||||
return log.NewLogger(
|
||||
log.Name("glauth"),
|
||||
log.Level(cfg.Log.Level),
|
||||
log.Pretty(cfg.Log.Pretty),
|
||||
log.Color(cfg.Log.Color),
|
||||
log.File(cfg.Log.File),
|
||||
)
|
||||
return oclog.LoggerFromConfig("glauth", *cfg.Log)
|
||||
}
|
||||
|
||||
// ParseConfig loads glauth configuration from Viper known paths.
|
||||
// ParseConfig loads glauth configuration from known paths.
|
||||
func ParseConfig(c *cli.Context, cfg *config.Config) error {
|
||||
sync.ParsingViperConfig.Lock()
|
||||
defer sync.ParsingViperConfig.Unlock()
|
||||
logger := NewLogger(cfg)
|
||||
|
||||
viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
|
||||
viper.SetEnvPrefix("GLAUTH")
|
||||
viper.AutomaticEnv()
|
||||
|
||||
if c.IsSet("config-file") {
|
||||
viper.SetConfigFile(c.String("config-file"))
|
||||
} else {
|
||||
viper.SetConfigName("glauth")
|
||||
|
||||
viper.AddConfigPath("/etc/ocis")
|
||||
viper.AddConfigPath("$HOME/.ocis")
|
||||
viper.AddConfigPath("./config")
|
||||
conf, err := ociscfg.BindSourcesToStructs("glauth", cfg)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := viper.ReadInConfig(); err != nil {
|
||||
switch err.(type) {
|
||||
case viper.ConfigFileNotFoundError:
|
||||
logger.Debug().
|
||||
Msg("no config found on preconfigured location")
|
||||
case viper.UnsupportedConfigError:
|
||||
logger.Fatal().
|
||||
Err(err).
|
||||
Msg("unsupported config type")
|
||||
default:
|
||||
logger.Fatal().
|
||||
Err(err).
|
||||
Msg("failed to read config")
|
||||
// provide with defaults for shared logging, since we need a valid destination address for BindEnv.
|
||||
if cfg.Log == nil && cfg.Commons != nil && cfg.Commons.Log != nil {
|
||||
cfg.Log = &shared.Log{
|
||||
Level: cfg.Commons.Log.Level,
|
||||
Pretty: cfg.Commons.Log.Pretty,
|
||||
Color: cfg.Commons.Log.Color,
|
||||
File: cfg.Commons.Log.File,
|
||||
}
|
||||
} else if cfg.Log == nil && cfg.Commons == nil {
|
||||
cfg.Log = &shared.Log{}
|
||||
}
|
||||
|
||||
if err := viper.Unmarshal(&cfg); err != nil {
|
||||
logger.Fatal().
|
||||
Err(err).
|
||||
Msg("failed to parse config")
|
||||
}
|
||||
|
||||
return nil
|
||||
// load all env variables relevant to the config in the current context.
|
||||
conf.LoadOSEnv(config.GetEnv(cfg), false)
|
||||
bindings := config.StructMappings(cfg)
|
||||
return ociscfg.BindEnv(conf, bindings)
|
||||
}
|
||||
|
||||
// SutureService allows for the glauth command to be embedded and supervised by a suture supervisor tree.
|
||||
@@ -120,10 +87,7 @@ type SutureService struct {
|
||||
|
||||
// NewSutureService creates a new glauth.SutureService
|
||||
func NewSutureService(cfg *ociscfg.Config) suture.Service {
|
||||
if cfg.Mode == 0 {
|
||||
cfg.GLAuth.Supervised = true
|
||||
}
|
||||
cfg.GLAuth.Log.File = cfg.Log.File
|
||||
cfg.GLAuth.Commons = cfg.Commons
|
||||
return SutureService{
|
||||
cfg: cfg.GLAuth,
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ import (
|
||||
"github.com/oklog/run"
|
||||
accounts "github.com/owncloud/ocis/accounts/pkg/proto/v0"
|
||||
"github.com/owncloud/ocis/glauth/pkg/config"
|
||||
"github.com/owncloud/ocis/glauth/pkg/flagset"
|
||||
"github.com/owncloud/ocis/glauth/pkg/metrics"
|
||||
"github.com/owncloud/ocis/glauth/pkg/server/debug"
|
||||
"github.com/owncloud/ocis/glauth/pkg/server/glauth"
|
||||
@@ -24,24 +23,15 @@ func Server(cfg *config.Config) *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "server",
|
||||
Usage: "Start integrated server",
|
||||
Flags: flagset.ServerWithConfig(cfg),
|
||||
Before: func(ctx *cli.Context) error {
|
||||
logger := NewLogger(cfg)
|
||||
if cfg.HTTP.Root != "/" {
|
||||
cfg.HTTP.Root = strings.TrimSuffix(cfg.HTTP.Root, "/")
|
||||
}
|
||||
// StringSliceFlag doesn't support Destination
|
||||
// UPDATE Destination on string flags supported. Wait for https://github.com/urfave/cli/pull/1078 to get to micro/cli
|
||||
if len(ctx.StringSlice("backend-server")) > 0 {
|
||||
cfg.Backend.Servers = ctx.StringSlice("backend-server")
|
||||
|
||||
if err := ParseConfig(ctx, cfg); err != nil {
|
||||
return err
|
||||
}
|
||||
if len(ctx.StringSlice("fallback-server")) > 0 {
|
||||
cfg.Fallback.Servers = ctx.StringSlice("fallback-server")
|
||||
}
|
||||
if !cfg.Supervised {
|
||||
return ParseConfig(ctx, cfg)
|
||||
}
|
||||
logger.Debug().Strs("backend-server", ctx.StringSlice("backend-server")).Str("service", "glauth").Msg("ignoring config file parsing when running supervised")
|
||||
|
||||
return nil
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
|
||||
@@ -1,78 +1,79 @@
|
||||
package config
|
||||
|
||||
import "context"
|
||||
import (
|
||||
"context"
|
||||
"path"
|
||||
|
||||
// Log defines the available logging configuration.
|
||||
type Log struct {
|
||||
Level string
|
||||
Pretty bool
|
||||
Color bool
|
||||
File string
|
||||
}
|
||||
"github.com/owncloud/ocis/ocis-pkg/shared"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/config/defaults"
|
||||
)
|
||||
|
||||
// Debug defines the available debug configuration.
|
||||
type Debug struct {
|
||||
Addr string
|
||||
Token string
|
||||
Pprof bool
|
||||
Zpages bool
|
||||
Addr string `ocisConfig:"addr"`
|
||||
Token string `ocisConfig:"token"`
|
||||
Pprof bool `ocisConfig:"pprof"`
|
||||
Zpages bool `ocisConfig:"zpages"`
|
||||
}
|
||||
|
||||
// HTTP defines the available http configuration.
|
||||
type HTTP struct {
|
||||
Addr string
|
||||
Namespace string
|
||||
Root string
|
||||
Addr string `ocisConfig:"addr"`
|
||||
Namespace string `ocisConfig:"namespace"`
|
||||
Root string `ocisConfig:"root"`
|
||||
}
|
||||
|
||||
// Tracing defines the available tracing configuration.
|
||||
type Tracing struct {
|
||||
Enabled bool
|
||||
Type string
|
||||
Endpoint string
|
||||
Collector string
|
||||
Service string
|
||||
Enabled bool `ocisConfig:"enabled"`
|
||||
Type string `ocisConfig:"type"`
|
||||
Endpoint string `ocisConfig:"endpoint"`
|
||||
Collector string `ocisConfig:"collector"`
|
||||
Service string `ocisConfig:"service"`
|
||||
}
|
||||
|
||||
// Ldap defined the available LDAP configuration.
|
||||
type Ldap struct {
|
||||
Addr string
|
||||
Enabled bool
|
||||
Enabled bool `ocisConfig:"enabled"`
|
||||
Addr string `ocisConfig:"addr"`
|
||||
}
|
||||
|
||||
// Ldaps defined the available LDAPS configuration.
|
||||
type Ldaps struct {
|
||||
Addr string
|
||||
Enabled bool
|
||||
Cert string
|
||||
Key string
|
||||
Addr string `ocisConfig:"addr"`
|
||||
Enabled bool `ocisConfig:"enabled"`
|
||||
Cert string `ocisConfig:"cert"`
|
||||
Key string `ocisConfig:"key"`
|
||||
}
|
||||
|
||||
// Backend defined the available backend configuration.
|
||||
type Backend struct {
|
||||
Datastore string
|
||||
BaseDN string
|
||||
Insecure bool
|
||||
NameFormat string
|
||||
GroupFormat string
|
||||
Servers []string
|
||||
SSHKeyAttr string
|
||||
UseGraphAPI bool
|
||||
Datastore string `ocisConfig:"datastore"`
|
||||
BaseDN string `ocisConfig:"base_dn"`
|
||||
Insecure bool `ocisConfig:"insecure"`
|
||||
NameFormat string `ocisConfig:"name_format"`
|
||||
GroupFormat string `ocisConfig:"group_format"`
|
||||
Servers []string `ocisConfig:"servers"`
|
||||
SSHKeyAttr string `ocisConfig:"ssh_key_attr"`
|
||||
UseGraphAPI bool `ocisConfig:"use_graph_api"`
|
||||
}
|
||||
|
||||
// Config combines all available configuration parts.
|
||||
type Config struct {
|
||||
File string
|
||||
Log Log
|
||||
Debug Debug
|
||||
HTTP HTTP
|
||||
Tracing Tracing
|
||||
Ldap Ldap
|
||||
Ldaps Ldaps
|
||||
Backend Backend
|
||||
Fallback Backend
|
||||
Version string
|
||||
RoleBundleUUID string
|
||||
*shared.Commons
|
||||
|
||||
File string `ocisConfig:"file"`
|
||||
Log *shared.Log `ocisConfig:"log"`
|
||||
Debug Debug `ocisConfig:"debug"`
|
||||
HTTP HTTP `ocisConfig:"http"`
|
||||
Tracing Tracing `ocisConfig:"tracing"`
|
||||
Ldap Ldap `ocisConfig:"ldap"`
|
||||
Ldaps Ldaps `ocisConfig:"ldaps"`
|
||||
Backend Backend `ocisConfig:"backend"`
|
||||
Fallback Backend `ocisConfig:"fallback"`
|
||||
Version string `ocisConfig:"version"`
|
||||
RoleBundleUUID string `ocisConfig:"role_bundle_uuid"`
|
||||
|
||||
Context context.Context
|
||||
Supervised bool
|
||||
@@ -82,3 +83,47 @@ type Config struct {
|
||||
func New() *Config {
|
||||
return &Config{}
|
||||
}
|
||||
|
||||
func DefaultConfig() *Config {
|
||||
return &Config{
|
||||
Debug: Debug{
|
||||
Addr: "127.0.0.1:9129",
|
||||
},
|
||||
HTTP: HTTP{},
|
||||
Tracing: Tracing{
|
||||
Type: "jaeger",
|
||||
Service: "glauth",
|
||||
},
|
||||
Ldap: Ldap{
|
||||
Enabled: true,
|
||||
Addr: "127.0.0.1:9125",
|
||||
},
|
||||
Ldaps: Ldaps{
|
||||
Addr: "127.0.0.1:9126",
|
||||
Enabled: true,
|
||||
Cert: path.Join(defaults.BaseDataPath(), "ldap", "ldap.crt"),
|
||||
Key: path.Join(defaults.BaseDataPath(), "ldap", "ldap.key"),
|
||||
},
|
||||
Backend: Backend{
|
||||
Datastore: "accounts",
|
||||
BaseDN: "dc=ocis,dc=test",
|
||||
Insecure: false,
|
||||
NameFormat: "cn",
|
||||
GroupFormat: "ou",
|
||||
Servers: nil,
|
||||
SSHKeyAttr: "sshPublicKey",
|
||||
UseGraphAPI: true,
|
||||
},
|
||||
Fallback: Backend{
|
||||
Datastore: "",
|
||||
BaseDN: "dc=ocis,dc=test",
|
||||
Insecure: false,
|
||||
NameFormat: "cn",
|
||||
GroupFormat: "ou",
|
||||
Servers: nil,
|
||||
SSHKeyAttr: "sshPublicKey",
|
||||
UseGraphAPI: true,
|
||||
},
|
||||
RoleBundleUUID: "71881883-1768-46bd-a24d-a356a2afdf7f", // BundleUUIDRoleAdmin
|
||||
}
|
||||
}
|
||||
|
||||
167
glauth/pkg/config/mappings.go
Normal file
167
glauth/pkg/config/mappings.go
Normal file
@@ -0,0 +1,167 @@
|
||||
package config
|
||||
|
||||
import "github.com/owncloud/ocis/ocis-pkg/shared"
|
||||
|
||||
// GetEnv fetches a list of known env variables for this extension. It is to be used by gookit, as it provides a list
|
||||
// with all the environment variables an extension supports.
|
||||
func GetEnv(cfg *Config) []string {
|
||||
var r = make([]string, len(structMappings(cfg)))
|
||||
for i := range structMappings(cfg) {
|
||||
r = append(r, structMappings(cfg)[i].EnvVars...)
|
||||
}
|
||||
|
||||
return r
|
||||
}
|
||||
|
||||
// StructMappings binds a set of environment variables to a destination on cfg. Iterating over this set and editing the
|
||||
// Destination value of a binding will alter the original value, as it is a pointer to its memory address. This lets
|
||||
// us propagate changes easier.
|
||||
func StructMappings(cfg *Config) []shared.EnvBinding {
|
||||
return structMappings(cfg)
|
||||
}
|
||||
|
||||
// structMappings binds a set of environment variables to a destination on cfg.
|
||||
func structMappings(cfg *Config) []shared.EnvBinding {
|
||||
return []shared.EnvBinding{
|
||||
{
|
||||
EnvVars: []string{"OCIS_LOG_LEVEL", "GLAUTH_LOG_LEVEL"},
|
||||
Destination: &cfg.Log.Level,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_LOG_PRETTY", "GLAUTH_LOG_PRETTY"},
|
||||
Destination: &cfg.Log.Pretty,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_LOG_COLOR", "GLAUTH_LOG_COLOR"},
|
||||
Destination: &cfg.Log.Color,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_LOG_FILE", "GLAUTH_LOG_FILE"},
|
||||
Destination: &cfg.Log.File,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"GLAUTH_CONFIG_FILE"},
|
||||
Destination: &cfg.File,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_TRACING_ENABLED", "GLAUTH_TRACING_ENABLED"},
|
||||
Destination: &cfg.Tracing.Enabled,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_TRACING_TYPE", "GLAUTH_TRACING_TYPE"},
|
||||
Destination: &cfg.Tracing.Type,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_TRACING_ENDPOINT", "GLAUTH_TRACING_ENDPOINT"},
|
||||
Destination: &cfg.Tracing.Endpoint,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_TRACING_COLLECTOR", "GLAUTH_TRACING_COLLECTOR"},
|
||||
Destination: &cfg.Tracing.Collector,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"GLAUTH_TRACING_SERVICE"},
|
||||
Destination: &cfg.Tracing.Service,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"GLAUTH_DEBUG_ADDR"},
|
||||
Destination: &cfg.Debug.Addr,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"GLAUTH_DEBUG_TOKEN"},
|
||||
Destination: &cfg.Debug.Token,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"GLAUTH_DEBUG_PPROF"},
|
||||
Destination: &cfg.Debug.Pprof,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"GLAUTH_DEBUG_ZPAGES"},
|
||||
Destination: &cfg.Debug.Zpages,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"GLAUTH_ROLE_BUNDLE_ID"},
|
||||
Destination: &cfg.RoleBundleUUID,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"GLAUTH_LDAP_ADDR"},
|
||||
Destination: &cfg.Ldap.Addr,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"GLAUTH_LDAP_ENABLED"},
|
||||
Destination: &cfg.Ldap.Enabled,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"GLAUTH_LDAPS_ADDR"},
|
||||
Destination: &cfg.Ldaps.Addr,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"GLAUTH_LDAPS_ENABLED"},
|
||||
Destination: &cfg.Ldaps.Enabled,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"GLAUTH_LDAPS_CERT"},
|
||||
Destination: &cfg.Ldaps.Cert,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"GLAUTH_LDAPS_KEY"},
|
||||
Destination: &cfg.Ldaps.Key,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"GLAUTH_BACKEND_BASEDN"},
|
||||
Destination: &cfg.Backend.BaseDN,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"GLAUTH_BACKEND_NAME_FORMAT"},
|
||||
Destination: &cfg.Backend.NameFormat,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"GLAUTH_BACKEND_GROUP_FORMAT"},
|
||||
Destination: &cfg.Backend.GroupFormat,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"GLAUTH_BACKEND_SSH_KEY_ATTR"},
|
||||
Destination: &cfg.Backend.SSHKeyAttr,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"GLAUTH_BACKEND_DATASTORE"},
|
||||
Destination: &cfg.Backend.Datastore,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"GLAUTH_BACKEND_INSECURE"},
|
||||
Destination: &cfg.Backend.Insecure,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"GLAUTH_BACKEND_USE_GRAPHAPI"},
|
||||
Destination: &cfg.Backend.UseGraphAPI,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"GLAUTH_FALLBACK_BASEDN"},
|
||||
Destination: &cfg.Fallback.BaseDN,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"GLAUTH_FALLBACK_NAME_FORMAT"},
|
||||
Destination: &cfg.Fallback.NameFormat,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"GLAUTH_FALLBACK_GROUP_FORMAT"},
|
||||
Destination: &cfg.Fallback.GroupFormat,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"GLAUTH_FALLBACK_SSH_KEY_ATTR"},
|
||||
Destination: &cfg.Fallback.SSHKeyAttr,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"GLAUTH_FALLBACK_DATASTORE"},
|
||||
Destination: &cfg.Fallback.Datastore,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"GLAUTH_FALLBACK_INSECURE"},
|
||||
Destination: &cfg.Fallback.Insecure,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"GLAUTH_FALLBACK_USE_GRAPHAPI"},
|
||||
Destination: &cfg.Fallback.UseGraphAPI,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -1,299 +0,0 @@
|
||||
package flagset
|
||||
|
||||
import (
|
||||
"path"
|
||||
|
||||
"github.com/owncloud/ocis/glauth/pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/config/defaults"
|
||||
"github.com/owncloud/ocis/ocis-pkg/flags"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
// RootWithConfig applies cfg to the root flagset
|
||||
func RootWithConfig(cfg *config.Config) []cli.Flag {
|
||||
return []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "log-level",
|
||||
Usage: "Set logging level",
|
||||
EnvVars: []string{"GLAUTH_LOG_LEVEL", "OCIS_LOG_LEVEL"},
|
||||
Destination: &cfg.Log.Level,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "log-pretty",
|
||||
Usage: "Enable pretty logging",
|
||||
EnvVars: []string{"GLAUTH_LOG_PRETTY", "OCIS_LOG_PRETTY"},
|
||||
Destination: &cfg.Log.Pretty,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "log-color",
|
||||
Usage: "Enable colored logging",
|
||||
EnvVars: []string{"GLAUTH_LOG_COLOR", "OCIS_LOG_COLOR"},
|
||||
Destination: &cfg.Log.Color,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// HealthWithConfig applies cfg to the root flagset
|
||||
func HealthWithConfig(cfg *config.Config) []cli.Flag {
|
||||
return []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "debug-addr",
|
||||
Value: flags.OverrideDefaultString(cfg.Debug.Addr, "127.0.0.1:9129"),
|
||||
Usage: "Address to debug endpoint",
|
||||
EnvVars: []string{"GLAUTH_DEBUG_ADDR"},
|
||||
Destination: &cfg.Debug.Addr,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// ServerWithConfig applies cfg to the root flagset
|
||||
func ServerWithConfig(cfg *config.Config) []cli.Flag {
|
||||
return []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "log-file",
|
||||
Usage: "Enable log to file",
|
||||
EnvVars: []string{"GLAUTH_LOG_FILE", "OCIS_LOG_FILE"},
|
||||
Destination: &cfg.Log.File,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "config-file",
|
||||
Value: flags.OverrideDefaultString(cfg.File, ""),
|
||||
Usage: "Path to config file",
|
||||
EnvVars: []string{"GLAUTH_CONFIG_FILE"},
|
||||
Destination: &cfg.File,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "tracing-enabled",
|
||||
Usage: "Enable sending traces",
|
||||
EnvVars: []string{"GLAUTH_TRACING_ENABLED", "OCIS_TRACING_ENABLED"},
|
||||
Destination: &cfg.Tracing.Enabled,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "tracing-type",
|
||||
Value: flags.OverrideDefaultString(cfg.Tracing.Type, "jaeger"),
|
||||
Usage: "Tracing backend type",
|
||||
EnvVars: []string{"GLAUTH_TRACING_TYPE", "OCIS_TRACING_TYPE"},
|
||||
Destination: &cfg.Tracing.Type,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "tracing-endpoint",
|
||||
Value: flags.OverrideDefaultString(cfg.Tracing.Endpoint, ""),
|
||||
Usage: "Endpoint for the agent",
|
||||
EnvVars: []string{"GLAUTH_TRACING_ENDPOINT", "OCIS_TRACING_ENDPOINT"},
|
||||
Destination: &cfg.Tracing.Endpoint,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "tracing-collector",
|
||||
Value: flags.OverrideDefaultString(cfg.Tracing.Collector, ""),
|
||||
Usage: "Endpoint for the collector",
|
||||
EnvVars: []string{"GLAUTH_TRACING_COLLECTOR", "OCIS_TRACING_COLLECTOR"},
|
||||
Destination: &cfg.Tracing.Collector,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "tracing-service",
|
||||
Value: flags.OverrideDefaultString(cfg.Tracing.Service, "glauth"),
|
||||
Usage: "Service name for tracing",
|
||||
EnvVars: []string{"GLAUTH_TRACING_SERVICE"},
|
||||
Destination: &cfg.Tracing.Service,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "debug-addr",
|
||||
Value: flags.OverrideDefaultString(cfg.Debug.Addr, "127.0.0.1:9129"),
|
||||
Usage: "Address to bind debug server",
|
||||
EnvVars: []string{"GLAUTH_DEBUG_ADDR"},
|
||||
Destination: &cfg.Debug.Addr,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "debug-token",
|
||||
Value: flags.OverrideDefaultString(cfg.Debug.Token, ""),
|
||||
Usage: "Token to grant metrics access",
|
||||
EnvVars: []string{"GLAUTH_DEBUG_TOKEN"},
|
||||
Destination: &cfg.Debug.Token,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "debug-pprof",
|
||||
Usage: "Enable pprof debugging",
|
||||
EnvVars: []string{"GLAUTH_DEBUG_PPROF"},
|
||||
Destination: &cfg.Debug.Pprof,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "debug-zpages",
|
||||
Usage: "Enable zpages debugging",
|
||||
EnvVars: []string{"GLAUTH_DEBUG_ZPAGES"},
|
||||
Destination: &cfg.Debug.Zpages,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "role-bundle-id",
|
||||
Value: flags.OverrideDefaultString(cfg.RoleBundleUUID, "71881883-1768-46bd-a24d-a356a2afdf7f"), // BundleUUIDRoleAdmin
|
||||
Usage: "roleid used to make internal grpc requests",
|
||||
EnvVars: []string{"GLAUTH_ROLE_BUNDLE_ID"},
|
||||
Destination: &cfg.RoleBundleUUID,
|
||||
},
|
||||
|
||||
&cli.StringFlag{
|
||||
Name: "ldap-addr",
|
||||
Value: flags.OverrideDefaultString(cfg.Ldap.Addr, "127.0.0.1:9125"),
|
||||
Usage: "Address to bind ldap server",
|
||||
EnvVars: []string{"GLAUTH_LDAP_ADDR"},
|
||||
Destination: &cfg.Ldap.Addr,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "ldap-enabled",
|
||||
Value: flags.OverrideDefaultBool(cfg.Ldap.Enabled, true),
|
||||
Usage: "Enable ldap server",
|
||||
EnvVars: []string{"GLAUTH_LDAP_ENABLED"},
|
||||
Destination: &cfg.Ldap.Enabled,
|
||||
},
|
||||
|
||||
&cli.StringFlag{
|
||||
Name: "ldaps-addr",
|
||||
Value: flags.OverrideDefaultString(cfg.Ldaps.Addr, "127.0.0.1:9126"),
|
||||
Usage: "Address to bind ldaps server",
|
||||
EnvVars: []string{"GLAUTH_LDAPS_ADDR"},
|
||||
Destination: &cfg.Ldaps.Addr,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "ldaps-enabled",
|
||||
Value: flags.OverrideDefaultBool(cfg.Ldaps.Enabled, true),
|
||||
Usage: "Enable ldaps server",
|
||||
EnvVars: []string{"GLAUTH_LDAPS_ENABLED"},
|
||||
Destination: &cfg.Ldaps.Enabled,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "ldaps-cert",
|
||||
Value: flags.OverrideDefaultString(cfg.Ldaps.Cert, path.Join(defaults.BaseDataPath(), "ldap", "ldap.crt")),
|
||||
Usage: "path to ldaps certificate in PEM format",
|
||||
EnvVars: []string{"GLAUTH_LDAPS_CERT"},
|
||||
Destination: &cfg.Ldaps.Cert,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "ldaps-key",
|
||||
Value: flags.OverrideDefaultString(cfg.Ldaps.Key, path.Join(defaults.BaseDataPath(), "ldap", "ldap.key")),
|
||||
Usage: "path to ldaps key in PEM format",
|
||||
EnvVars: []string{"GLAUTH_LDAPS_KEY"},
|
||||
Destination: &cfg.Ldaps.Key,
|
||||
},
|
||||
|
||||
// backend config
|
||||
|
||||
&cli.StringFlag{
|
||||
Name: "backend-basedn",
|
||||
Value: flags.OverrideDefaultString(cfg.Backend.BaseDN, "dc=ocis,dc=test"),
|
||||
Usage: "base distinguished name to expose",
|
||||
EnvVars: []string{"GLAUTH_BACKEND_BASEDN"},
|
||||
Destination: &cfg.Backend.BaseDN,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "backend-name-format",
|
||||
Value: flags.OverrideDefaultString(cfg.Backend.NameFormat, "cn"),
|
||||
Usage: "name attribute for entries to expose. typically cn or uid",
|
||||
EnvVars: []string{"GLAUTH_BACKEND_NAME_FORMAT"},
|
||||
Destination: &cfg.Backend.NameFormat,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "backend-group-format",
|
||||
Value: flags.OverrideDefaultString(cfg.Backend.GroupFormat, "ou"),
|
||||
Usage: "name attribute for entries to expose. typically ou, cn or dc",
|
||||
EnvVars: []string{"GLAUTH_BACKEND_GROUP_FORMAT"},
|
||||
Destination: &cfg.Backend.GroupFormat,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "backend-ssh-key-attr",
|
||||
Value: flags.OverrideDefaultString(cfg.Backend.SSHKeyAttr, "sshPublicKey"),
|
||||
Usage: "ssh key attribute for entries to expose",
|
||||
EnvVars: []string{"GLAUTH_BACKEND_SSH_KEY_ATTR"},
|
||||
Destination: &cfg.Backend.SSHKeyAttr,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "backend-datastore",
|
||||
Value: flags.OverrideDefaultString(cfg.Backend.Datastore, "accounts"),
|
||||
// TODO bring back config / flat file support
|
||||
Usage: "datastore to use as the backend. one of accounts, ldap or owncloud",
|
||||
EnvVars: []string{"GLAUTH_BACKEND_DATASTORE"},
|
||||
Destination: &cfg.Backend.Datastore,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "backend-insecure",
|
||||
Value: flags.OverrideDefaultBool(cfg.Backend.Insecure, false),
|
||||
Usage: "Allow insecure requests to the datastore",
|
||||
EnvVars: []string{"GLAUTH_BACKEND_INSECURE"},
|
||||
Destination: &cfg.Backend.Insecure,
|
||||
},
|
||||
&cli.StringSliceFlag{
|
||||
Name: "backend-server",
|
||||
Value: cli.NewStringSlice(),
|
||||
Usage: `--backend-server https://demo.owncloud.com/apps/graphapi/v1.0 [--backend-server "https://demo2.owncloud.com/apps/graphapi/v1.0"]`,
|
||||
EnvVars: []string{"GLAUTH_BACKEND_SERVERS"},
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "backend-use-graphapi",
|
||||
Value: flags.OverrideDefaultBool(cfg.Backend.UseGraphAPI, true),
|
||||
Usage: "use Graph API, only for owncloud datastore",
|
||||
EnvVars: []string{"GLAUTH_BACKEND_USE_GRAPHAPI"},
|
||||
Destination: &cfg.Backend.UseGraphAPI,
|
||||
},
|
||||
|
||||
// fallback config
|
||||
|
||||
&cli.StringFlag{
|
||||
Name: "fallback-basedn",
|
||||
Value: flags.OverrideDefaultString(cfg.Fallback.BaseDN, "dc=ocis,dc=test"),
|
||||
Usage: "base distinguished name to expose",
|
||||
EnvVars: []string{"GLAUTH_FALLBACK_BASEDN"},
|
||||
Destination: &cfg.Fallback.BaseDN,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "fallback-name-format",
|
||||
Value: flags.OverrideDefaultString(cfg.Fallback.NameFormat, "cn"),
|
||||
Usage: "name attribute for entries to expose. typically cn or uid",
|
||||
EnvVars: []string{"GLAUTH_FALLBACK_NAME_FORMAT"},
|
||||
Destination: &cfg.Fallback.NameFormat,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "fallback-group-format",
|
||||
Value: flags.OverrideDefaultString(cfg.Fallback.GroupFormat, "ou"),
|
||||
Usage: "name attribute for entries to expose. typically ou, cn or dc",
|
||||
EnvVars: []string{"GLAUTH_FALLBACK_GROUP_FORMAT"},
|
||||
Destination: &cfg.Fallback.GroupFormat,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "fallback-ssh-key-attr",
|
||||
Value: flags.OverrideDefaultString(cfg.Fallback.SSHKeyAttr, "sshPublicKey"),
|
||||
Usage: "ssh key attribute for entries to expose",
|
||||
EnvVars: []string{"GLAUTH_FALLBACK_SSH_KEY_ATTR"},
|
||||
Destination: &cfg.Fallback.SSHKeyAttr,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "fallback-datastore",
|
||||
Value: flags.OverrideDefaultString(cfg.Fallback.Datastore, ""),
|
||||
// TODO bring back config / flat file support
|
||||
Usage: "datastore to use as the fallback. one of accounts, ldap or owncloud",
|
||||
EnvVars: []string{"GLAUTH_FALLBACK_DATASTORE"},
|
||||
Destination: &cfg.Fallback.Datastore,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "fallback-insecure",
|
||||
Value: flags.OverrideDefaultBool(cfg.Fallback.Insecure, false),
|
||||
Usage: "Allow insecure requests to the datastore",
|
||||
EnvVars: []string{"GLAUTH_FALLBACK_INSECURE"},
|
||||
Destination: &cfg.Fallback.Insecure,
|
||||
},
|
||||
&cli.StringSliceFlag{
|
||||
Name: "fallback-server",
|
||||
Value: cli.NewStringSlice("https://demo.owncloud.com/apps/graphapi/v1.0"),
|
||||
Usage: `--fallback-server http://internal1.example.com [--fallback-server http://internal2.example.com]`,
|
||||
EnvVars: []string{"GLAUTH_FALLBACK_SERVERS"},
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "fallback-use-graphapi",
|
||||
Value: flags.OverrideDefaultBool(cfg.Fallback.UseGraphAPI, true),
|
||||
Usage: "use Graph API, only for owncloud datastore",
|
||||
EnvVars: []string{"GLAUTH_FALLBACK_USE_GRAPHAPI"},
|
||||
Destination: &cfg.Fallback.UseGraphAPI,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "extensions",
|
||||
Usage: "Run specific extensions during supervised mode. This flag is set by the runtime",
|
||||
},
|
||||
}
|
||||
}
|
||||
14
go.mod
14
go.mod
@@ -31,6 +31,7 @@ require (
|
||||
github.com/golang-jwt/jwt/v4 v4.1.0
|
||||
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0
|
||||
github.com/golang/protobuf v1.5.2
|
||||
github.com/gookit/config/v2 v2.0.27
|
||||
github.com/gorilla/mux v1.8.0
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.6.0
|
||||
github.com/iancoleman/strcase v0.2.0
|
||||
@@ -51,7 +52,6 @@ require (
|
||||
github.com/rs/zerolog v1.26.0
|
||||
github.com/sirupsen/logrus v1.8.1
|
||||
github.com/spf13/cobra v1.2.1
|
||||
github.com/spf13/viper v1.9.0
|
||||
github.com/stretchr/testify v1.7.0
|
||||
github.com/thejerf/suture/v4 v4.0.1
|
||||
github.com/urfave/cli/v2 v2.3.0
|
||||
@@ -69,11 +69,13 @@ require (
|
||||
google.golang.org/genproto v0.0.0-20211020151524-b7c3a969101a
|
||||
google.golang.org/grpc v1.42.0
|
||||
google.golang.org/protobuf v1.27.1
|
||||
gopkg.in/yaml.v2 v2.4.0
|
||||
gotest.tools/v3 v3.0.3
|
||||
stash.kopano.io/kgol/rndm v1.1.1
|
||||
)
|
||||
|
||||
require (
|
||||
cloud.google.com/go v0.93.3 // indirect
|
||||
contrib.go.opencensus.io/exporter/prometheus v0.4.0 // indirect
|
||||
github.com/Azure/go-ntlmssp v0.0.0-20200615164410-66371956d46c // indirect
|
||||
github.com/Masterminds/goutils v1.1.1 // indirect
|
||||
@@ -137,16 +139,17 @@ require (
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
|
||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
||||
github.com/golang/mock v1.6.0 // indirect
|
||||
github.com/golang/snappy v0.0.4 // indirect
|
||||
github.com/gomodule/redigo v1.8.5 // indirect
|
||||
github.com/google/go-cmp v0.5.6 // indirect
|
||||
github.com/google/go-querystring v1.1.0 // indirect
|
||||
github.com/google/uuid v1.3.0 // indirect
|
||||
github.com/gookit/goutil v0.3.15 // indirect
|
||||
github.com/gorilla/schema v1.2.0 // indirect
|
||||
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
|
||||
github.com/hashicorp/go-hclog v1.0.0 // indirect
|
||||
github.com/hashicorp/go-plugin v1.4.3 // indirect
|
||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||
github.com/hashicorp/yamux v0.0.0-20210826001029-26ff87cf9493 // indirect
|
||||
github.com/huandu/xstrings v1.3.2 // indirect
|
||||
github.com/imdario/mergo v0.3.12 // indirect
|
||||
@@ -160,7 +163,6 @@ require (
|
||||
github.com/klauspost/compress v1.13.6 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.0.9 // indirect
|
||||
github.com/longsleep/go-metrics v1.0.0 // indirect
|
||||
github.com/magiconair/properties v1.8.5 // indirect
|
||||
github.com/mattermost/xml-roundtrip-validator v0.1.0 // indirect
|
||||
github.com/mattn/go-colorable v0.1.11 // indirect
|
||||
github.com/mattn/go-isatty v0.0.14 // indirect
|
||||
@@ -189,7 +191,6 @@ require (
|
||||
github.com/orcaman/concurrent-map v0.0.0-20210501183033-44dafcb38ecc // indirect
|
||||
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c // indirect
|
||||
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
|
||||
github.com/pelletier/go-toml v1.9.4 // indirect
|
||||
github.com/pkg/xattr v0.4.4 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/pquerna/cachecontrol v0.1.0 // indirect
|
||||
@@ -213,13 +214,9 @@ require (
|
||||
github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749 // indirect
|
||||
github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546 // indirect
|
||||
github.com/sony/gobreaker v0.4.1 // indirect
|
||||
github.com/spf13/afero v1.6.0 // indirect
|
||||
github.com/spf13/cast v1.4.1 // indirect
|
||||
github.com/spf13/jwalterweatherman v1.1.0 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/steveyen/gtreap v0.1.0 // indirect
|
||||
github.com/studio-b12/gowebdav v0.0.0-20210917133250-a3a86976a1df // indirect
|
||||
github.com/subosito/gotenv v1.2.0 // indirect
|
||||
github.com/tus/tusd v1.6.0 // indirect
|
||||
github.com/wk8/go-ordered-map v0.2.0 // indirect
|
||||
github.com/xanzy/ssh-agent v0.3.1 // indirect
|
||||
@@ -241,7 +238,6 @@ require (
|
||||
gopkg.in/square/go-jose.v2 v2.6.0 // indirect
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
|
||||
gopkg.in/warnings.v0 v0.1.2 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
|
||||
stash.kopano.io/kgol/kcc-go/v5 v5.0.1 // indirect
|
||||
stash.kopano.io/kgol/oidc-go v0.3.2 // indirect
|
||||
|
||||
64
go.sum
64
go.sum
@@ -37,7 +37,6 @@ cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM7
|
||||
cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
|
||||
cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk=
|
||||
cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk=
|
||||
cloud.google.com/go/firestore v1.6.0/go.mod h1:afJwI0vaXwAG54kI7A//lP/lSPDkQORQuMkv56TxEPU=
|
||||
cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I=
|
||||
cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw=
|
||||
cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA=
|
||||
@@ -106,6 +105,7 @@ github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWX
|
||||
github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
|
||||
github.com/acomagu/bufpipe v1.0.3 h1:fxAGrHZTgQ9w5QqVItgzwj235/uYZYgbXitB+dLupOk=
|
||||
github.com/acomagu/bufpipe v1.0.3/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4=
|
||||
github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
|
||||
github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM=
|
||||
github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw=
|
||||
github.com/akamai/AkamaiOPEN-edgegrid-golang v1.1.0/go.mod h1:kX6YddBkXqqywAe8c9LyvgTCyFuZCTMF4cRPQhc3Fy8=
|
||||
@@ -121,12 +121,14 @@ github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 h1:kFOfPq6dUM1hTo
|
||||
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c=
|
||||
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
|
||||
github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
|
||||
github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM=
|
||||
github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk=
|
||||
github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo=
|
||||
github.com/arl/statsviz v0.4.0/go.mod h1:+5inUy/dxy11x/KSmicG3ZrEEy0Yr81AFm3dn4QC04M=
|
||||
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
|
||||
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
|
||||
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
|
||||
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
|
||||
github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
|
||||
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
|
||||
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
|
||||
github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
|
||||
@@ -509,6 +511,7 @@ github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LB
|
||||
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 h1:p104kn46Q8WdvHunIJ9dAyjPVtrBPhSr3KT2yUst43I=
|
||||
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
|
||||
github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=
|
||||
github.com/gobs/pretty v0.0.0-20180724170744-09732c25a95b/go.mod h1:Xo4aNUOrJnVruqWQJBtW6+bTBDTniY8yZum5rF3b5jw=
|
||||
github.com/gobuffalo/attrs v0.0.0-20190224210810-a9411de4debd/go.mod h1:4duuawTqi2wkkpB4ePgWMaai6/Kc6WEz83bhFwpHzj0=
|
||||
github.com/gobuffalo/depgen v0.0.0-20190329151759-d478694a28d3/go.mod h1:3STtPUQYuzV0gBVOY3vy6CfMm/ljR4pABfrTeHNLHUY=
|
||||
@@ -575,6 +578,7 @@ github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3K
|
||||
github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=
|
||||
github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
|
||||
github.com/golang/protobuf v0.0.0-20170622202551-6a1fa9404c0a/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
@@ -649,7 +653,15 @@ github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
|
||||
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
|
||||
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
|
||||
github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0=
|
||||
github.com/gookit/color v1.4.2 h1:tXy44JFSFkKnELV6WaMo/lLfu/meqITX3iAV52do7lk=
|
||||
github.com/gookit/color v1.4.2/go.mod h1:fqRyamkC1W8uxl+lxCQxOT09l/vYfZ+QeiX3rKQHCoQ=
|
||||
github.com/gookit/config/v2 v2.0.27 h1:jCQSAe3qN8gFABz6h4qA9MNhTk0D4ipn6+1jeAD7g9E=
|
||||
github.com/gookit/config/v2 v2.0.27/go.mod h1:q7I5c+hWOlzGh8jLff6CuNV6H2RDZ1QanaBEimGGtwE=
|
||||
github.com/gookit/goutil v0.3.14/go.mod h1:YdGV0ObqRUlRq4/RzAQBHcd1Wzl/jKw7cppDBtD3q+U=
|
||||
github.com/gookit/goutil v0.3.15 h1:nfMiE1nlBES16zOsLzNeR/vo6a7KlV58womgG6dB+JM=
|
||||
github.com/gookit/goutil v0.3.15/go.mod h1:2w7h+/CB6n2m4qzECHj6+TOmMR8q7ierD9+LyybGy3I=
|
||||
github.com/gookit/ini/v2 v2.0.11 h1:Wl651xN2AaJbFrb8daBwWo8kS+sQHL3TddFi0/PRNXs=
|
||||
github.com/gookit/ini/v2 v2.0.11/go.mod h1:rIY8Uup5WDdPsrEE7VrF7fcMdGCCcPGA22Bk5R7roJQ=
|
||||
github.com/gophercloud/gophercloud v0.15.1-0.20210202035223-633d73521055/go.mod h1:wRtmUelyIIv3CSSDI47aUwbs075O6i+LY+pXsKCBsb4=
|
||||
github.com/gophercloud/gophercloud v0.16.0/go.mod h1:wRtmUelyIIv3CSSDI47aUwbs075O6i+LY+pXsKCBsb4=
|
||||
github.com/gophercloud/utils v0.0.0-20210216074907-f6de111f2eae/go.mod h1:wx8HMD8oQD0Ryhz6+6ykq75PJ79iPyEqYHfwZ4l7OsA=
|
||||
@@ -677,13 +689,10 @@ github.com/grpc-ecosystem/grpc-gateway/v2 v2.6.0 h1:rgxjzoDmDXw5q8HONgyHhBas4to0
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.6.0/go.mod h1:qrJPVzv9YlhsrxJc3P/Q85nr0w1lIRikTl4JlhdDH5w=
|
||||
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplbc8s8sSb3V2oUCygFHVp8gC3Dn6U4MNI=
|
||||
github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q=
|
||||
github.com/hashicorp/consul/api v1.10.1/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M=
|
||||
github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=
|
||||
github.com/hashicorp/consul/sdk v0.8.0/go.mod h1:GBvyrGALthsZObzUGsfgHZQDXjg4lOjagTIwIR1vPms=
|
||||
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||
github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
|
||||
github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
|
||||
github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ=
|
||||
github.com/hashicorp/go-hclog v0.14.1/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ=
|
||||
github.com/hashicorp/go-hclog v0.16.2/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ=
|
||||
github.com/hashicorp/go-hclog v1.0.0 h1:bkKf0BeBXcSYa7f5Fyi9gMuQ8gNsxeiNpZjR6VxNZeo=
|
||||
@@ -691,12 +700,10 @@ github.com/hashicorp/go-hclog v1.0.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39E
|
||||
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
|
||||
github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
|
||||
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
|
||||
github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA=
|
||||
github.com/hashicorp/go-plugin v1.4.3 h1:DXmvivbWD5qdiBts9TpBC7BYL1Aia5sxbRgQB+v6UZM=
|
||||
github.com/hashicorp/go-plugin v1.4.3/go.mod h1:5fGEH17QVwTTcR0zV7yhDPLLmFX9YSZ38b18Udy6vYQ=
|
||||
github.com/hashicorp/go-retryablehttp v0.6.6/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY=
|
||||
github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU=
|
||||
github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8=
|
||||
github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU=
|
||||
github.com/hashicorp/go-sockaddr v1.0.2/go.mod h1:rB4wwRAUzs07qva3c5SdrY/NEtAUjGlgmH/UkBUC97A=
|
||||
github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4=
|
||||
@@ -706,16 +713,13 @@ github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/b
|
||||
github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90=
|
||||
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
|
||||
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
||||
github.com/hashicorp/hcl/v2 v2.10.1/go.mod h1:FwWsfWEjyV/CMj8s/gqAuiviY72rJ1/oayI9WftqcKg=
|
||||
github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
|
||||
github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ=
|
||||
github.com/hashicorp/mdns v1.0.1/go.mod h1:4gW7WsVCke5TE7EPeYliwHlRUyBtfCwuFwuMg2DmyNY=
|
||||
github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I=
|
||||
github.com/hashicorp/memberlist v0.2.2/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE=
|
||||
github.com/hashicorp/memberlist v0.2.4/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE=
|
||||
github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
|
||||
github.com/hashicorp/serf v0.9.5/go.mod h1:UWDWwZeL5cuWDJdl0C6wrvrUwEqtQ4ZKBKKENpqIUyk=
|
||||
github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM=
|
||||
github.com/hashicorp/yamux v0.0.0-20210826001029-26ff87cf9493 h1:brI5vBRUlAlM34VFmnLPwjnCL/FxAJp9XvOdX6Zt+XE=
|
||||
github.com/hashicorp/yamux v0.0.0-20210826001029-26ff87cf9493/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ=
|
||||
@@ -810,6 +814,7 @@ github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k=
|
||||
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
|
||||
github.com/labbsr0x/bindman-dns-webhook v1.0.2/go.mod h1:p6b+VCXIR8NYKpDr8/dg1HKfQoRHCdcsROXKvmoehKA=
|
||||
github.com/labbsr0x/goh v1.0.1/go.mod h1:8K2UhVoaWXcCU7Lxoa2omWnC8gyW8px7/lmO61c027w=
|
||||
@@ -831,7 +836,6 @@ github.com/m3o/m3o-go/client v0.0.0-20210421144725-8bfd7992ada3/go.mod h1:vmeaYr
|
||||
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
|
||||
github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
|
||||
github.com/magiconair/properties v1.8.4/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60=
|
||||
github.com/magiconair/properties v1.8.5 h1:b6kJs+EmPFMYGkow9GiUyCyOvIwYetYJ3fSaWak/Gls=
|
||||
github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60=
|
||||
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||
github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||
@@ -850,7 +854,6 @@ github.com/mattermost/xml-roundtrip-validator v0.1.0/go.mod h1:qccnGMcpgwcNaBnxq
|
||||
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
||||
github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
|
||||
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
|
||||
github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
|
||||
github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
|
||||
github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
|
||||
github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
|
||||
@@ -862,6 +865,7 @@ github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2y
|
||||
github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84=
|
||||
github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE=
|
||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||
github.com/mattn/go-isatty v0.0.13/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
|
||||
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
||||
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
||||
@@ -897,7 +901,6 @@ github.com/minio/sha256-simd v0.1.1/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl
|
||||
github.com/minio/sha256-simd v1.0.0 h1:v1ta+49hkWZyvaKwrQB8elexRqm6Y0aMLjCNsrYxo6g=
|
||||
github.com/minio/sha256-simd v1.0.0/go.mod h1:OuYzVNI5vcoYIAmbIvHPl3N3jUzVedXbKy5RFepssQM=
|
||||
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
|
||||
github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI=
|
||||
github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw=
|
||||
github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s=
|
||||
github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
||||
@@ -908,6 +911,7 @@ github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eI
|
||||
github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU=
|
||||
github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8=
|
||||
github.com/mitchellh/go-vnc v0.0.0-20150629162542-723ed9867aed/go.mod h1:3rdaFaCv4AyBgu5ALFM0+tSuHrBh6v692nyQe3ikrq0=
|
||||
github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
|
||||
github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
|
||||
github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg=
|
||||
github.com/mitchellh/hashstructure v1.1.0 h1:P6P1hdjqAAknpY/M1CGipelZgp+4y9ja9kmUZPXP+H0=
|
||||
@@ -1020,8 +1024,6 @@ github.com/pelletier/go-toml v1.4.0/go.mod h1:PN7xzY2wHTK0K9p34ErDQMlFxa51Fk0OUr
|
||||
github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE=
|
||||
github.com/pelletier/go-toml v1.8.1/go.mod h1:T2/BmBdy8dvIRq1a/8aqjN41wvWlN4lrapLU/GW4pbc=
|
||||
github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
|
||||
github.com/pelletier/go-toml v1.9.4 h1:tjENF6MfZAg8e4ZmZTeWaWiT2vXtsoO6+iuOjFhECwM=
|
||||
github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
|
||||
github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
|
||||
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
|
||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
@@ -1035,7 +1037,6 @@ github.com/pkg/xattr v0.4.4/go.mod h1:sBD3RAqlr8Q+RC3FutZcikpT8nyDrIEEBw2J744gVW
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
|
||||
github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s=
|
||||
github.com/pquerna/cachecontrol v0.0.0-20180517163645-1555304b9b35/go.mod h1:prYjPmNq4d1NPVmpShWobRqXY3q7Vp+80DqgxxUrUIA=
|
||||
github.com/pquerna/cachecontrol v0.1.0 h1:yJMy84ti9h/+OEWa752kBTKv4XC30OtVVHYv/8cTqKc=
|
||||
github.com/pquerna/cachecontrol v0.1.0/go.mod h1:NrUG3Z7Rdu85UNR3vm7SOsl1nFIeSiQnrHV5K9mBcUI=
|
||||
@@ -1128,7 +1129,6 @@ github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQD
|
||||
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=
|
||||
github.com/sacloud/libsacloud v1.36.2/go.mod h1:P7YAOVmnIn3DKHqCZcUKYUXmSwGBm3yS7IBEjKVSrjg=
|
||||
github.com/sagikazarmark/crypt v0.1.0/go.mod h1:B/mN0msZuINBtQ1zZLEQcegFJJf9vnYIR88KRMEuODE=
|
||||
github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
|
||||
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
|
||||
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.7.0.20210127161313-bd30bebeac4f/go.mod h1:CJJ5VAbozOl0yEw7nHB9+7BXTJbIn6h7W+f6Gau5IP8=
|
||||
@@ -1169,12 +1169,9 @@ github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJ
|
||||
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
|
||||
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
|
||||
github.com/spf13/afero v1.4.1/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I=
|
||||
github.com/spf13/afero v1.6.0 h1:xoax2sJ2DT8S8xA2paPFjDCScCNeWsg75VG0DLRreiY=
|
||||
github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I=
|
||||
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
|
||||
github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
|
||||
github.com/spf13/cast v1.4.1 h1:s0hze+J0196ZfEMTs80N7UlFt0BDuQ7Q+JDnHiMWKdA=
|
||||
github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
|
||||
github.com/spf13/cobra v0.0.1/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
|
||||
github.com/spf13/cobra v0.0.2-0.20171109065643-2da4a54c5cee/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
|
||||
github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
|
||||
@@ -1183,10 +1180,10 @@ github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJ
|
||||
github.com/spf13/cobra v1.2.1 h1:+KmjbUw1hriSNMF55oPrkZcb27aECyrj8V2ytv7kWDw=
|
||||
github.com/spf13/cobra v1.2.1/go.mod h1:ExllRjgxM/piMAM+3tAZvg8fsklGAf3tPfi+i8t68Nk=
|
||||
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
|
||||
github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk=
|
||||
github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo=
|
||||
github.com/spf13/pflag v1.0.0/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||
github.com/spf13/pflag v1.0.1-0.20171106142849-4c012f6dcd95/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||
github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
@@ -1194,8 +1191,6 @@ github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DM
|
||||
github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg=
|
||||
github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg=
|
||||
github.com/spf13/viper v1.8.1/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH9Ns=
|
||||
github.com/spf13/viper v1.9.0 h1:yR6EXjTp0y0cLN8OZg1CRZmOBdI88UcGkhgyJhu6nZk=
|
||||
github.com/spf13/viper v1.9.0/go.mod h1:+i6ajR7OX2XaiBkrcZJFK21htRk7eDeLg7+O6bhUPP4=
|
||||
github.com/steveyen/gtreap v0.1.0 h1:CjhzTa274PyJLJuMZwIzCO1PfC00oRa8d1Kc78bFXJM=
|
||||
github.com/steveyen/gtreap v0.1.0/go.mod h1:kl/5J7XbrOmlIbYIXdRHDDE5QxHqpk0cmkT7Z4dM9/Y=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
@@ -1212,7 +1207,6 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/studio-b12/gowebdav v0.0.0-20210917133250-a3a86976a1df h1:C+J/LwTqP8gRPt1MdSzBNZP0OYuDm5wsmDKgwpLjYzo=
|
||||
github.com/studio-b12/gowebdav v0.0.0-20210917133250-a3a86976a1df/go.mod h1:gCcfDlA1Y7GqOaeEKw5l9dOGx1VLdc/HuQSlQAaZ30s=
|
||||
github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s=
|
||||
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
|
||||
github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ=
|
||||
github.com/thanhpk/randstr v1.0.4 h1:IN78qu/bR+My+gHCvMEXhR/i5oriVHcTB/BJJIRTsNo=
|
||||
@@ -1243,6 +1237,9 @@ github.com/valyala/fasttemplate v1.1.0/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPU
|
||||
github.com/vektah/gqlparser v1.1.2/go.mod h1:1ycwN7Ij5njmMkPPAOaRFY4rET2Enx7IkVv3vaXspKw=
|
||||
github.com/vimeo/go-util v1.2.0/go.mod h1:s13SMDTSO7AjH1nbgp707mfN5JFIWUFDU5MDDuRRtKs=
|
||||
github.com/vinyldns/go-vinyldns v0.0.0-20200917153823-148a5f6b8f14/go.mod h1:RWc47jtnVuQv6+lY3c768WtXCas/Xi+U5UFc5xULmYg=
|
||||
github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=
|
||||
github.com/vmihailenco/msgpack/v4 v4.3.12/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4=
|
||||
github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI=
|
||||
github.com/vultr/govultr/v2 v2.0.0/go.mod h1:2PsEeg+gs3p/Fo5Pw8F9mv+DUBEOlrNZ8GmCTGmhOhs=
|
||||
github.com/wk8/go-ordered-map v0.2.0 h1:KlvGyHstD1kkGZkPtHCyCfRYS0cz84uk6rrW/Dnhdtk=
|
||||
github.com/wk8/go-ordered-map v0.2.0/go.mod h1:9ZIbRunKbuvfPKyBP1SIKLcXNlv74YCOZ3t3VTS6gRk=
|
||||
@@ -1259,11 +1256,14 @@ github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:
|
||||
github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=
|
||||
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
|
||||
github.com/xlab/treeprint v1.1.0/go.mod h1:gj5Gd3gPdKtR1ikdDK6fnFLdmIS0X30kTTuNd/WEJu0=
|
||||
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 h1:QldyIu/L63oPpyvQmHgvgickp1Yw510KJOqX7H24mg8=
|
||||
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778/go.mod h1:2MuV+tbUrU1zIOPMxZ5EncGwgmMJsa+9ucAQZXxsObs=
|
||||
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
|
||||
github.com/yaegashi/msgraph.go v0.1.1-0.20200221123608-2d438cf2a7cc/go.mod h1:tso14hwzqX4VbnWTNsxiL0DvMb2OwbGISFA7jDibdWc=
|
||||
github.com/yaegashi/msgraph.go v0.1.4 h1:leDXSczAbwBpYFSmmZrdByTiPoUw8dbTfNMetAjJvbw=
|
||||
github.com/yaegashi/msgraph.go v0.1.4/go.mod h1:vgeYhHa5skJt/3lTyjGXThTZhwbhRnGo6uUxzoJIGME=
|
||||
github.com/yaegashi/wtz.go v0.0.2/go.mod h1:nOLA5QXsmdkRxBkP5tljhua13ADHCKirLBrzPf4PEJc=
|
||||
github.com/yosuke-furukawa/json5 v0.1.1/go.mod h1:sw49aWDqNdRJ6DYUtIQiaA3xyj2IL9tjeNYmX2ixwcU=
|
||||
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA=
|
||||
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
@@ -1271,6 +1271,9 @@ github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de
|
||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
||||
github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
||||
github.com/zclconf/go-cty v1.2.0/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8=
|
||||
github.com/zclconf/go-cty v1.8.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk=
|
||||
github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b/go.mod h1:ZRKQfBXbGkpdV6QMzT3rU1kSTAnfu1dO8dPKjYprgj8=
|
||||
github.com/zenazn/goji v0.9.1-0.20160507202103-64eb34159fe5/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q=
|
||||
go-micro.dev/v4 v4.1.0/go.mod h1:XTEJj5ILOBW+2ndGDG56r8fBXZ8hmsVaIaS1K5zwj+s=
|
||||
go-micro.dev/v4 v4.2.1/go.mod h1:XTEJj5ILOBW+2ndGDG56r8fBXZ8hmsVaIaS1K5zwj+s=
|
||||
@@ -1351,6 +1354,7 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk
|
||||
golang.org/x/crypto v0.0.0-20190320223903-b7391e95e576/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20190418165655-df01cb2cc480/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE=
|
||||
golang.org/x/crypto v0.0.0-20190422162423-af44ce270edf/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE=
|
||||
golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20190530122614-20be4c3c3ed5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
@@ -1375,7 +1379,6 @@ golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm
|
||||
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8=
|
||||
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa h1:idItI2DDfCokpg0N51B2VtiLdJ4vAuXC9fnCb2gACo4=
|
||||
golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
@@ -1423,6 +1426,7 @@ golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/net v0.0.0-20180530234432-1e491301e022/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20181005035420-146acd28ed58/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
@@ -1539,6 +1543,7 @@ golang.org/x/sys v0.0.0-20190415081028-16da32be82c5/go.mod h1:h1NjWce9XRLGQEsW7w
|
||||
golang.org/x/sys v0.0.0-20190419153524-e8e3143a4f4a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190531175056-4c3a928424d2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
@@ -1565,7 +1570,6 @@ golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7w
|
||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200120151820-655fe14d7479/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
@@ -1615,7 +1619,6 @@ golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBc
|
||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210921065528-437939a70204/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20211110154304-99a53858aa08 h1:WecRHqgE09JBkh/584XIE6PMz5KKE/vER4izNUi30AQ=
|
||||
@@ -1758,7 +1761,6 @@ google.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtuk
|
||||
google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw=
|
||||
google.golang.org/api v0.51.0/go.mod h1:t4HdrdoNgyN5cbEfm7Lum0lcLDLiise1F8qDKX00sOU=
|
||||
google.golang.org/api v0.54.0/go.mod h1:7C4bFFOvVDGXjfDTAsgGwDgAxRDeQ4X8NvUedIt6z3k=
|
||||
google.golang.org/api v0.56.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE=
|
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
@@ -1823,8 +1825,6 @@ google.golang.org/genproto v0.0.0-20210716133855-ce7ef5c701ea/go.mod h1:AxrInvYm
|
||||
google.golang.org/genproto v0.0.0-20210728212813-7823e685a01f/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48=
|
||||
google.golang.org/genproto v0.0.0-20210805201207-89edb61ffb67/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48=
|
||||
google.golang.org/genproto v0.0.0-20210813162853-db860fec028c/go.mod h1:cFeNkxwySK631ADgubI+/XFU/xp8FD5KIVV4rj8UC5w=
|
||||
google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=
|
||||
google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=
|
||||
google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=
|
||||
google.golang.org/genproto v0.0.0-20211020151524-b7c3a969101a h1:8maMHMQp9NroHXhc3HelFX9Ay2lWlXLcdH5mw5Biz0s=
|
||||
google.golang.org/genproto v0.0.0-20211020151524-b7c3a969101a/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
if err := command.Execute(config.New()); err != nil {
|
||||
if err := command.Execute(config.DefaultConfig()); err != nil {
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
"net/http"
|
||||
|
||||
"github.com/owncloud/ocis/graph-explorer/pkg/config"
|
||||
"github.com/owncloud/ocis/graph-explorer/pkg/flagset"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
@@ -14,7 +13,9 @@ func Health(cfg *config.Config) *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "health",
|
||||
Usage: "Check health status",
|
||||
Flags: flagset.HealthWithConfig(cfg),
|
||||
Before: func(c *cli.Context) error {
|
||||
return ParseConfig(c, cfg)
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
logger := NewLogger(cfg)
|
||||
|
||||
|
||||
@@ -3,15 +3,11 @@ package command
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/owncloud/ocis/graph-explorer/pkg/config"
|
||||
"github.com/owncloud/ocis/graph-explorer/pkg/flagset"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/log"
|
||||
"github.com/owncloud/ocis/ocis-pkg/sync"
|
||||
"github.com/owncloud/ocis/ocis-pkg/version"
|
||||
"github.com/spf13/viper"
|
||||
"github.com/thejerf/suture/v4"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
@@ -23,32 +19,25 @@ func Execute(cfg *config.Config) error {
|
||||
Version: version.String,
|
||||
Usage: "Serve Graph-Explorer for oCIS",
|
||||
Compiled: version.Compiled(),
|
||||
|
||||
Authors: []*cli.Author{
|
||||
{
|
||||
Name: "ownCloud GmbH",
|
||||
Email: "support@owncloud.com",
|
||||
},
|
||||
},
|
||||
|
||||
Flags: flagset.RootWithConfig(cfg),
|
||||
|
||||
Before: func(c *cli.Context) error {
|
||||
cfg.Server.Version = version.String
|
||||
return ParseConfig(c, cfg)
|
||||
},
|
||||
|
||||
Commands: []*cli.Command{
|
||||
Server(cfg),
|
||||
Health(cfg),
|
||||
},
|
||||
}
|
||||
|
||||
cli.HelpFlag = &cli.BoolFlag{
|
||||
Name: "help,h",
|
||||
Usage: "Show the help",
|
||||
}
|
||||
|
||||
cli.VersionFlag = &cli.BoolFlag{
|
||||
Name: "version,v",
|
||||
Usage: "Print the version",
|
||||
@@ -68,49 +57,16 @@ func NewLogger(cfg *config.Config) log.Logger {
|
||||
)
|
||||
}
|
||||
|
||||
// ParseConfig loads accounts configuration from Viper known paths.
|
||||
// ParseConfig loads graph configuration from known paths.
|
||||
func ParseConfig(c *cli.Context, cfg *config.Config) error {
|
||||
sync.ParsingViperConfig.Lock()
|
||||
defer sync.ParsingViperConfig.Unlock()
|
||||
logger := NewLogger(cfg)
|
||||
|
||||
viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
|
||||
viper.SetEnvPrefix("GRAPH_EXPLORER")
|
||||
viper.AutomaticEnv()
|
||||
|
||||
if c.IsSet("config-file") {
|
||||
viper.SetConfigFile(c.String("config-file"))
|
||||
} else {
|
||||
viper.SetConfigName("graph-explorer")
|
||||
|
||||
viper.AddConfigPath("/etc/ocis")
|
||||
viper.AddConfigPath("$HOME/.ocis")
|
||||
viper.AddConfigPath("./config")
|
||||
conf, err := ociscfg.BindSourcesToStructs("graph-explorer", cfg)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := viper.ReadInConfig(); err != nil {
|
||||
switch err.(type) {
|
||||
case viper.ConfigFileNotFoundError:
|
||||
logger.Info().
|
||||
Msg("Continue without config")
|
||||
case viper.UnsupportedConfigError:
|
||||
logger.Fatal().
|
||||
Err(err).
|
||||
Msg("Unsupported config type")
|
||||
default:
|
||||
logger.Fatal().
|
||||
Err(err).
|
||||
Msg("Failed to read config")
|
||||
}
|
||||
}
|
||||
|
||||
if err := viper.Unmarshal(&cfg); err != nil {
|
||||
logger.Fatal().
|
||||
Err(err).
|
||||
Msg("Failed to parse config")
|
||||
}
|
||||
|
||||
return nil
|
||||
conf.LoadOSEnv(config.GetEnv(), false)
|
||||
bindings := config.StructMappings(cfg)
|
||||
return ociscfg.BindEnv(conf, bindings)
|
||||
}
|
||||
|
||||
// SutureService allows for the graph-explorer command to be embedded and supervised by a suture supervisor tree.
|
||||
@@ -120,10 +76,7 @@ type SutureService struct {
|
||||
|
||||
// NewSutureService creates a new graph-explorer.SutureService
|
||||
func NewSutureService(cfg *ociscfg.Config) suture.Service {
|
||||
if cfg.Mode == 0 {
|
||||
cfg.GraphExplorer.Supervised = true
|
||||
}
|
||||
cfg.GraphExplorer.Log.File = cfg.Log.File
|
||||
cfg.GraphExplorer.Log = cfg.Log
|
||||
return SutureService{
|
||||
cfg: cfg.GraphExplorer,
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
|
||||
"github.com/oklog/run"
|
||||
"github.com/owncloud/ocis/graph-explorer/pkg/config"
|
||||
"github.com/owncloud/ocis/graph-explorer/pkg/flagset"
|
||||
"github.com/owncloud/ocis/graph-explorer/pkg/metrics"
|
||||
"github.com/owncloud/ocis/graph-explorer/pkg/server/debug"
|
||||
"github.com/owncloud/ocis/graph-explorer/pkg/server/http"
|
||||
@@ -20,24 +19,15 @@ func Server(cfg *config.Config) *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "server",
|
||||
Usage: "Start integrated server",
|
||||
Flags: flagset.ServerWithConfig(cfg),
|
||||
Before: func(ctx *cli.Context) error {
|
||||
logger := NewLogger(cfg)
|
||||
if cfg.HTTP.Root != "/" {
|
||||
cfg.HTTP.Root = strings.TrimSuffix(cfg.HTTP.Root, "/")
|
||||
}
|
||||
|
||||
// When running on single binary mode the before hook from the root command won't get called. We manually
|
||||
// call this before hook from ocis command, so the configuration can be loaded.
|
||||
if !cfg.Supervised {
|
||||
return ParseConfig(ctx, cfg)
|
||||
}
|
||||
logger.Debug().Str("service", "graph-explorer").Msg("ignoring config file parsing when running supervised")
|
||||
return nil
|
||||
return ParseConfig(ctx, cfg)
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
logger := NewLogger(cfg)
|
||||
|
||||
tracing.Configure(cfg)
|
||||
|
||||
var (
|
||||
|
||||
@@ -1,62 +1,58 @@
|
||||
package config
|
||||
|
||||
import "context"
|
||||
import (
|
||||
"context"
|
||||
|
||||
// Log defines the available logging configuration.
|
||||
type Log struct {
|
||||
Level string
|
||||
Pretty bool
|
||||
Color bool
|
||||
File string
|
||||
}
|
||||
"github.com/owncloud/ocis/ocis-pkg/shared"
|
||||
)
|
||||
|
||||
// Debug defines the available debug configuration.
|
||||
type Debug struct {
|
||||
Addr string
|
||||
Token string
|
||||
Pprof bool
|
||||
Zpages bool
|
||||
Addr string `ocisConfig:"addr"`
|
||||
Token string `ocisConfig:"token"`
|
||||
Pprof bool `ocisConfig:"pprof"`
|
||||
Zpages bool `ocisConfig:"zpages"`
|
||||
}
|
||||
|
||||
// HTTP defines the available http configuration.
|
||||
type HTTP struct {
|
||||
Addr string
|
||||
Root string
|
||||
Namespace string
|
||||
Addr string `ocisConfig:"addr"`
|
||||
Root string `ocisConfig:"root"`
|
||||
Namespace string `ocisConfig:"namespace"`
|
||||
}
|
||||
|
||||
// Server configures a server.
|
||||
type Server struct {
|
||||
Version string
|
||||
Name string
|
||||
Version string `ocisConfig:"version"`
|
||||
Name string `ocisConfig:"name"`
|
||||
}
|
||||
|
||||
// Tracing defines the available tracing configuration.
|
||||
type Tracing struct {
|
||||
Enabled bool
|
||||
Type string
|
||||
Endpoint string
|
||||
Collector string
|
||||
Service string
|
||||
Enabled bool `ocisConfig:"enabled"`
|
||||
Type string `ocisConfig:"type"`
|
||||
Endpoint string `ocisConfig:"endpoint"`
|
||||
Collector string `ocisConfig:"collector"`
|
||||
Service string `ocisConfig:"service"`
|
||||
}
|
||||
|
||||
// GraphExplorer defines the available graph-explorer configuration.
|
||||
type GraphExplorer struct {
|
||||
ClientID string
|
||||
Issuer string
|
||||
GraphURLBase string
|
||||
GraphURLPath string
|
||||
ClientID string `ocisConfig:"client_id"`
|
||||
Issuer string `ocisConfig:"issuer"`
|
||||
GraphURLBase string `ocisConfig:"graph_url_base"`
|
||||
GraphURLPath string `ocisConfig:"graph_url_path"`
|
||||
}
|
||||
|
||||
// Config combines all available configuration parts.
|
||||
type Config struct {
|
||||
File string
|
||||
Log Log
|
||||
Debug Debug
|
||||
HTTP HTTP
|
||||
Server Server
|
||||
Tracing Tracing
|
||||
GraphExplorer GraphExplorer
|
||||
File string `ocisConfig:"file"`
|
||||
Log shared.Log `ocisConfig:"log"`
|
||||
Debug Debug `ocisConfig:"debug"`
|
||||
HTTP HTTP `ocisConfig:"http"`
|
||||
Server Server `ocisConfig:"server"`
|
||||
Tracing Tracing `ocisConfig:"tracing"`
|
||||
GraphExplorer GraphExplorer `ocisConfig:"graph_explorer"`
|
||||
|
||||
Context context.Context
|
||||
Supervised bool
|
||||
@@ -66,3 +62,45 @@ type Config struct {
|
||||
func New() *Config {
|
||||
return &Config{}
|
||||
}
|
||||
|
||||
// DefaultConfig provides with a working version of a config.
|
||||
func DefaultConfig() *Config {
|
||||
return &Config{
|
||||
Log: shared.Log{},
|
||||
Debug: Debug{
|
||||
Addr: "127.0.0.1:9136",
|
||||
Token: "",
|
||||
Pprof: false,
|
||||
Zpages: false,
|
||||
},
|
||||
HTTP: HTTP{
|
||||
Addr: "127.0.0.1:9135",
|
||||
Root: "/graph-explorer",
|
||||
Namespace: "com.owncloud.web",
|
||||
},
|
||||
Server: Server{},
|
||||
Tracing: Tracing{
|
||||
Type: "jaeger",
|
||||
Endpoint: "",
|
||||
Collector: "",
|
||||
Service: "graph-explorer",
|
||||
},
|
||||
GraphExplorer: GraphExplorer{
|
||||
ClientID: "ocis-explorer.js",
|
||||
Issuer: "https://localhost:9200",
|
||||
GraphURLBase: "https://localhost:9200",
|
||||
GraphURLPath: "/graph",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// GetEnv fetches a list of known env variables for this extension. It is to be used by gookit, as it provides a list
|
||||
// with all the environment variables an extension supports.
|
||||
func GetEnv() []string {
|
||||
var r = make([]string, len(structMappings(&Config{})))
|
||||
for i := range structMappings(&Config{}) {
|
||||
r = append(r, structMappings(&Config{})[i].EnvVars...)
|
||||
}
|
||||
|
||||
return r
|
||||
}
|
||||
|
||||
96
graph-explorer/pkg/config/mappings.go
Normal file
96
graph-explorer/pkg/config/mappings.go
Normal file
@@ -0,0 +1,96 @@
|
||||
package config
|
||||
|
||||
import "github.com/owncloud/ocis/ocis-pkg/shared"
|
||||
|
||||
// StructMappings binds a set of environment variables to a destination on cfg. Iterating over this set and editing the
|
||||
// Destination value of a binding will alter the original value, as it is a pointer to its memory address. This lets
|
||||
// us propagate changes easier.
|
||||
func StructMappings(cfg *Config) []shared.EnvBinding {
|
||||
return structMappings(cfg)
|
||||
}
|
||||
|
||||
// structMappings binds a set of environment variables to a destination on cfg.
|
||||
func structMappings(cfg *Config) []shared.EnvBinding {
|
||||
return []shared.EnvBinding{
|
||||
{
|
||||
EnvVars: []string{"OCIS_LOG_LEVEL", "GRAPH_EXPLORER_LOG_LEVEL"},
|
||||
Destination: &cfg.Log.Level,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_LOG_PRETTY", "GRAPH_EXPLORER_LOG_PRETTY"},
|
||||
Destination: &cfg.Log.Pretty,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_LOG_COLOR", "GRAPH_EXPLORER_LOG_COLOR"},
|
||||
Destination: &cfg.Log.Color,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_LOG_FILE", "GRAPH_EXPLORER_LOG_FILE"},
|
||||
Destination: &cfg.Log.File,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_TRACING_ENABLED", "GRAPH_EXPLORER_TRACING_ENABLED"},
|
||||
Destination: &cfg.Tracing.Enabled,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_TRACING_TYPE", "GRAPH_EXPLORER_TRACING_TYPE"},
|
||||
Destination: &cfg.Tracing.Type,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_TRACING_ENDPOINT", "GRAPH_EXPLORER_TRACING_ENDPOINT"},
|
||||
Destination: &cfg.Tracing.Endpoint,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_TRACING_COLLECTOR", "GRAPH_EXPLORER_TRACING_COLLECTOR"},
|
||||
Destination: &cfg.Tracing.Collector,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"GRAPH_EXPLORER_TRACING_SERVICE"},
|
||||
Destination: &cfg.Tracing.Service,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"GRAPH_EXPLORER_DEBUG_ADDR"},
|
||||
Destination: &cfg.Debug.Addr,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"GRAPH_EXPLORER_DEBUG_TOKEN"},
|
||||
Destination: &cfg.Debug.Token,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"GRAPH_EXPLORER_DEBUG_PPROF"},
|
||||
Destination: &cfg.Debug.Pprof,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"GRAPH_EXPLORER_DEBUG_ZPAGES"},
|
||||
Destination: &cfg.Debug.Zpages,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"GRAPH_EXPLORER_HTTP_ADDR"},
|
||||
Destination: &cfg.HTTP.Addr,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"GRAPH_EXPLORER_HTTP_ROOT"},
|
||||
Destination: &cfg.HTTP.Root,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"GRAPH_EXPLORER_NAMESPACE"},
|
||||
Destination: &cfg.HTTP.Namespace,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_URL", "GRAPH_EXPLORER_ISSUER"},
|
||||
Destination: &cfg.GraphExplorer.Issuer,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"GRAPH_EXPLORER_CLIENT_ID"},
|
||||
Destination: &cfg.GraphExplorer.ClientID,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_URL", "GRAPH_EXPLORER_GRAPH_URL_BASE"},
|
||||
Destination: &cfg.GraphExplorer.GraphURLBase,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"GRAPH_EXPLORER_GRAPH_URL_PATH"},
|
||||
Destination: &cfg.GraphExplorer.GraphURLPath,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -1,169 +0,0 @@
|
||||
package flagset
|
||||
|
||||
import (
|
||||
"github.com/owncloud/ocis/graph-explorer/pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/flags"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
// RootWithConfig applies cfg to the root flagset
|
||||
func RootWithConfig(cfg *config.Config) []cli.Flag {
|
||||
return []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "log-level",
|
||||
Usage: "Set logging level",
|
||||
EnvVars: []string{"GRAPH_EXPLORER_LOG_LEVEL", "OCIS_LOG_LEVEL"},
|
||||
Destination: &cfg.Log.Level,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "log-pretty",
|
||||
Usage: "Enable pretty logging",
|
||||
EnvVars: []string{"GRAPH_EXPLORER_LOG_PRETTY", "OCIS_LOG_PRETTY"},
|
||||
Destination: &cfg.Log.Pretty,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "log-color",
|
||||
Usage: "Enable colored logging",
|
||||
EnvVars: []string{"GRAPH_EXPLORER_LOG_COLOR", "OCIS_LOG_COLOR"},
|
||||
Destination: &cfg.Log.Color,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// HealthWithConfig applies cfg to the root flagset
|
||||
func HealthWithConfig(cfg *config.Config) []cli.Flag {
|
||||
return []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "debug-addr",
|
||||
Value: flags.OverrideDefaultString(cfg.Debug.Addr, "127.0.0.1:9136"),
|
||||
Usage: "Address to debug endpoint",
|
||||
EnvVars: []string{"GRAPH_EXPLORER_DEBUG_ADDR"},
|
||||
Destination: &cfg.Debug.Addr,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// ServerWithConfig applies cfg to the root flagset
|
||||
func ServerWithConfig(cfg *config.Config) []cli.Flag {
|
||||
return []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "log-file",
|
||||
Usage: "Enable log to file",
|
||||
EnvVars: []string{"GRAPH_EXPLORER_LOG_FILE", "OCIS_LOG_FILE"},
|
||||
Destination: &cfg.Log.File,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "tracing-enabled",
|
||||
Usage: "Enable sending traces",
|
||||
EnvVars: []string{"GRAPH_EXPLORER_TRACING_ENABLED", "OCIS_TRACING_ENABLED"},
|
||||
Destination: &cfg.Tracing.Enabled,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "tracing-type",
|
||||
Value: flags.OverrideDefaultString(cfg.Tracing.Type, "jaeger"),
|
||||
Usage: "Tracing backend type",
|
||||
EnvVars: []string{"GRAPH_EXPLORER_TRACING_TYPE", "OCIS_TRACING_TYPE"},
|
||||
Destination: &cfg.Tracing.Type,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "tracing-endpoint",
|
||||
Value: flags.OverrideDefaultString(cfg.Tracing.Endpoint, ""),
|
||||
Usage: "Endpoint for the agent",
|
||||
EnvVars: []string{"GRAPH_EXPLORER_TRACING_ENDPOINT", "OCIS_TRACING_ENDPOINT"},
|
||||
Destination: &cfg.Tracing.Endpoint,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "tracing-collector",
|
||||
Value: flags.OverrideDefaultString(cfg.Tracing.Collector, ""),
|
||||
Usage: "Endpoint for the collector",
|
||||
EnvVars: []string{"GRAPH_EXPLORER_TRACING_COLLECTOR", "OCIS_TRACING_COLLECTOR"},
|
||||
Destination: &cfg.Tracing.Collector,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "tracing-service",
|
||||
Value: flags.OverrideDefaultString(cfg.Tracing.Service, "graph-explorer"),
|
||||
Usage: "Service name for tracing",
|
||||
EnvVars: []string{"GRAPH_EXPLORER_TRACING_SERVICE"},
|
||||
Destination: &cfg.Tracing.Service,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "debug-addr",
|
||||
Value: flags.OverrideDefaultString(cfg.Debug.Addr, "127.0.0.1:9136"),
|
||||
Usage: "Address to bind debug server",
|
||||
EnvVars: []string{"GRAPH_EXPLORER_DEBUG_ADDR"},
|
||||
Destination: &cfg.Debug.Addr,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "debug-token",
|
||||
Value: flags.OverrideDefaultString(cfg.Debug.Token, ""),
|
||||
Usage: "Token to grant metrics access",
|
||||
EnvVars: []string{"GRAPH_EXPLORER_DEBUG_TOKEN"},
|
||||
Destination: &cfg.Debug.Token,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "debug-pprof",
|
||||
Usage: "Enable pprof debugging",
|
||||
EnvVars: []string{"GRAPH_EXPLORER_DEBUG_PPROF"},
|
||||
Destination: &cfg.Debug.Pprof,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "debug-zpages",
|
||||
Usage: "Enable zpages debugging",
|
||||
EnvVars: []string{"GRAPH_EXPLORER_DEBUG_ZPAGES"},
|
||||
Destination: &cfg.Debug.Zpages,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "http-addr",
|
||||
Value: flags.OverrideDefaultString(cfg.HTTP.Addr, "127.0.0.1:9135"),
|
||||
Usage: "Address to bind http server",
|
||||
EnvVars: []string{"GRAPH_EXPLORER_HTTP_ADDR"},
|
||||
Destination: &cfg.HTTP.Addr,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "http-root",
|
||||
Value: flags.OverrideDefaultString(cfg.HTTP.Root, "/graph-explorer"),
|
||||
Usage: "Root path of http server",
|
||||
EnvVars: []string{"GRAPH_EXPLORER_HTTP_ROOT"},
|
||||
Destination: &cfg.HTTP.Root,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "http-namespace",
|
||||
Value: flags.OverrideDefaultString(cfg.HTTP.Namespace, "com.owncloud.web"),
|
||||
Usage: "Set the base namespace for the http namespace",
|
||||
EnvVars: []string{"GRAPH_EXPLORER_NAMESPACE"},
|
||||
Destination: &cfg.HTTP.Namespace,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "issuer",
|
||||
Value: flags.OverrideDefaultString(cfg.GraphExplorer.Issuer, "https://localhost:9200"),
|
||||
Usage: "Set the OpenID Connect Provider",
|
||||
EnvVars: []string{"GRAPH_EXPLORER_ISSUER", "OCIS_URL"},
|
||||
Destination: &cfg.GraphExplorer.Issuer,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "client-id",
|
||||
Value: flags.OverrideDefaultString(cfg.GraphExplorer.ClientID, "ocis-explorer.js"),
|
||||
Usage: "Set the OpenID Client ID to send to the issuer",
|
||||
EnvVars: []string{"GRAPH_EXPLORER_CLIENT_ID"},
|
||||
Destination: &cfg.GraphExplorer.ClientID,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "graph-url-base",
|
||||
Value: flags.OverrideDefaultString(cfg.GraphExplorer.GraphURLBase, "https://localhost:9200"),
|
||||
Usage: "Set the base url to the graph api service",
|
||||
EnvVars: []string{"GRAPH_EXPLORER_GRAPH_URL_BASE", "OCIS_URL"},
|
||||
Destination: &cfg.GraphExplorer.GraphURLBase,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "graph-url-path",
|
||||
Value: flags.OverrideDefaultString(cfg.GraphExplorer.GraphURLPath, "/graph"),
|
||||
Usage: "Set the url path to the graph api service",
|
||||
EnvVars: []string{"GRAPH_EXPLORER_GRAPH_URL_PATH"},
|
||||
Destination: &cfg.GraphExplorer.GraphURLPath,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "extensions",
|
||||
Usage: "Run specific extensions during supervised mode. This flag is set by the runtime",
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
"net/http"
|
||||
|
||||
"github.com/owncloud/ocis/graph/pkg/config"
|
||||
"github.com/owncloud/ocis/graph/pkg/flagset"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
@@ -14,7 +13,9 @@ func Health(cfg *config.Config) *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "health",
|
||||
Usage: "Check health status",
|
||||
Flags: flagset.HealthWithConfig(cfg),
|
||||
Before: func(c *cli.Context) error {
|
||||
return ParseConfig(c, cfg)
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
logger := NewLogger(cfg)
|
||||
|
||||
|
||||
@@ -3,17 +3,15 @@ package command
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/sync"
|
||||
"github.com/owncloud/ocis/ocis-pkg/shared"
|
||||
|
||||
"github.com/thejerf/suture/v4"
|
||||
|
||||
"github.com/owncloud/ocis/graph/pkg/config"
|
||||
"github.com/owncloud/ocis/graph/pkg/flagset"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/log"
|
||||
"github.com/owncloud/ocis/ocis-pkg/version"
|
||||
"github.com/spf13/viper"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
@@ -24,32 +22,25 @@ func Execute(cfg *config.Config) error {
|
||||
Version: version.String,
|
||||
Usage: "Serve Graph API for oCIS",
|
||||
Compiled: version.Compiled(),
|
||||
|
||||
Authors: []*cli.Author{
|
||||
{
|
||||
Name: "ownCloud GmbH",
|
||||
Email: "support@owncloud.com",
|
||||
},
|
||||
},
|
||||
|
||||
Flags: flagset.RootWithConfig(cfg),
|
||||
|
||||
Before: func(c *cli.Context) error {
|
||||
cfg.Server.Version = version.String
|
||||
return ParseConfig(c, cfg)
|
||||
},
|
||||
|
||||
Commands: []*cli.Command{
|
||||
Server(cfg),
|
||||
Health(cfg),
|
||||
},
|
||||
}
|
||||
|
||||
cli.HelpFlag = &cli.BoolFlag{
|
||||
Name: "help,h",
|
||||
Usage: "Show the help",
|
||||
}
|
||||
|
||||
cli.VersionFlag = &cli.BoolFlag{
|
||||
Name: "version,v",
|
||||
Usage: "Print the version",
|
||||
@@ -69,49 +60,28 @@ func NewLogger(cfg *config.Config) log.Logger {
|
||||
)
|
||||
}
|
||||
|
||||
// ParseConfig reads graph configuration from fs.
|
||||
// ParseConfig loads graph configuration from known paths.
|
||||
func ParseConfig(c *cli.Context, cfg *config.Config) error {
|
||||
sync.ParsingViperConfig.Lock()
|
||||
defer sync.ParsingViperConfig.Unlock()
|
||||
logger := NewLogger(cfg)
|
||||
|
||||
viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
|
||||
viper.SetEnvPrefix("GRAPH")
|
||||
viper.AutomaticEnv()
|
||||
|
||||
if c.IsSet("config-file") {
|
||||
viper.SetConfigFile(c.String("config-file"))
|
||||
} else {
|
||||
viper.SetConfigName("graph")
|
||||
|
||||
viper.AddConfigPath("/etc/ocis")
|
||||
viper.AddConfigPath("$HOME/.ocis")
|
||||
viper.AddConfigPath("./config")
|
||||
conf, err := ociscfg.BindSourcesToStructs("graph", cfg)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := viper.ReadInConfig(); err != nil {
|
||||
switch err.(type) {
|
||||
case viper.ConfigFileNotFoundError:
|
||||
logger.Info().
|
||||
Msg("Continue without config")
|
||||
case viper.UnsupportedConfigError:
|
||||
logger.Fatal().
|
||||
Err(err).
|
||||
Msg("Unsupported config type")
|
||||
default:
|
||||
logger.Fatal().
|
||||
Err(err).
|
||||
Msg("Failed to read config")
|
||||
// provide with defaults for shared logging, since we need a valid destination address for BindEnv.
|
||||
if cfg.Log == nil && cfg.Commons != nil && cfg.Commons.Log != nil {
|
||||
cfg.Log = &shared.Log{
|
||||
Level: cfg.Commons.Log.Level,
|
||||
Pretty: cfg.Commons.Log.Pretty,
|
||||
Color: cfg.Commons.Log.Color,
|
||||
File: cfg.Commons.Log.File,
|
||||
}
|
||||
} else if cfg.Log == nil && cfg.Commons == nil {
|
||||
cfg.Log = &shared.Log{}
|
||||
}
|
||||
|
||||
if err := viper.Unmarshal(&cfg); err != nil {
|
||||
logger.Fatal().
|
||||
Err(err).
|
||||
Msg("Failed to parse config")
|
||||
}
|
||||
|
||||
return nil
|
||||
conf.LoadOSEnv(config.GetEnv(cfg), false)
|
||||
bindings := config.StructMappings(cfg)
|
||||
return ociscfg.BindEnv(conf, bindings)
|
||||
}
|
||||
|
||||
// SutureService allows for the graph command to be embedded and supervised by a suture supervisor tree.
|
||||
@@ -121,10 +91,7 @@ type SutureService struct {
|
||||
|
||||
// NewSutureService creates a new graph.SutureService
|
||||
func NewSutureService(cfg *ociscfg.Config) suture.Service {
|
||||
if cfg.Mode == 0 {
|
||||
cfg.Graph.Supervised = true
|
||||
}
|
||||
cfg.Graph.Log.File = cfg.Log.File
|
||||
cfg.Graph.Commons = cfg.Commons
|
||||
return SutureService{
|
||||
cfg: cfg.Graph,
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
|
||||
"github.com/oklog/run"
|
||||
"github.com/owncloud/ocis/graph/pkg/config"
|
||||
"github.com/owncloud/ocis/graph/pkg/flagset"
|
||||
"github.com/owncloud/ocis/graph/pkg/metrics"
|
||||
"github.com/owncloud/ocis/graph/pkg/server/debug"
|
||||
"github.com/owncloud/ocis/graph/pkg/server/http"
|
||||
@@ -20,19 +19,15 @@ func Server(cfg *config.Config) *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "server",
|
||||
Usage: "Start integrated server",
|
||||
Flags: flagset.ServerWithConfig(cfg),
|
||||
Before: func(ctx *cli.Context) error {
|
||||
logger := NewLogger(cfg)
|
||||
if cfg.HTTP.Root != "/" {
|
||||
cfg.HTTP.Root = strings.TrimSuffix(cfg.HTTP.Root, "/")
|
||||
}
|
||||
|
||||
// When running on single binary mode the before hook from the root command won't get called. We manually
|
||||
// call this before hook from ocis command, so the configuration can be loaded.
|
||||
if !cfg.Supervised {
|
||||
return ParseConfig(ctx, cfg)
|
||||
if err := ParseConfig(ctx, cfg); err != nil {
|
||||
return err
|
||||
}
|
||||
logger.Debug().Str("service", "graph").Msg("ignoring config file parsing when running supervised")
|
||||
|
||||
return nil
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
|
||||
@@ -1,72 +1,70 @@
|
||||
package config
|
||||
|
||||
import "context"
|
||||
import (
|
||||
"context"
|
||||
|
||||
// Log defines the available logging configuration.
|
||||
type Log struct {
|
||||
Level string
|
||||
Pretty bool
|
||||
Color bool
|
||||
File string
|
||||
}
|
||||
"github.com/owncloud/ocis/ocis-pkg/shared"
|
||||
)
|
||||
|
||||
// Debug defines the available debug configuration.
|
||||
type Debug struct {
|
||||
Addr string
|
||||
Token string
|
||||
Pprof bool
|
||||
Zpages bool
|
||||
Addr string `ocisConfig:"addr"`
|
||||
Token string `ocisConfig:"token"`
|
||||
Pprof bool `ocisConfig:"pprof"`
|
||||
Zpages bool `ocisConfig:"zpages"`
|
||||
}
|
||||
|
||||
// HTTP defines the available http configuration.
|
||||
type HTTP struct {
|
||||
Addr string
|
||||
Namespace string
|
||||
Root string
|
||||
Addr string `ocisConfig:"addr"`
|
||||
Namespace string `ocisConfig:"namespace"`
|
||||
Root string `ocisConfig:"root"`
|
||||
}
|
||||
|
||||
// Server configures a server.
|
||||
type Server struct {
|
||||
Version string
|
||||
Name string
|
||||
Version string `ocisConfig:"version"`
|
||||
Name string `ocisConfig:"name"`
|
||||
}
|
||||
|
||||
// Tracing defines the available tracing configuration.
|
||||
type Tracing struct {
|
||||
Enabled bool
|
||||
Type string
|
||||
Endpoint string
|
||||
Collector string
|
||||
Service string
|
||||
Enabled bool `ocisConfig:"enabled"`
|
||||
Type string `ocisConfig:"type"`
|
||||
Endpoint string `ocisConfig:"endpoint"`
|
||||
Collector string `ocisConfig:"collector"`
|
||||
Service string `ocisConfig:"service"`
|
||||
}
|
||||
|
||||
// Reva defines all available REVA configuration.
|
||||
type Reva struct {
|
||||
Address string
|
||||
Address string `ocisConfig:"address"`
|
||||
}
|
||||
|
||||
// TokenManager is the config for using the reva token manager
|
||||
type TokenManager struct {
|
||||
JWTSecret string
|
||||
JWTSecret string `ocisConfig:"jwt_secret"`
|
||||
}
|
||||
|
||||
type Spaces struct {
|
||||
WebDavBase string
|
||||
WebDavPath string
|
||||
DefaultQuota string
|
||||
WebDavBase string `ocisConfig:"webdav_base"`
|
||||
WebDavPath string `ocisConfig:"webdav_path"`
|
||||
DefaultQuota string `ocisConfig:"default_quota"`
|
||||
}
|
||||
|
||||
// Config combines all available configuration parts.
|
||||
type Config struct {
|
||||
File string
|
||||
Log Log
|
||||
Debug Debug
|
||||
HTTP HTTP
|
||||
Server Server
|
||||
Tracing Tracing
|
||||
Reva Reva
|
||||
TokenManager TokenManager
|
||||
Spaces Spaces
|
||||
*shared.Commons
|
||||
|
||||
File string `ocisConfig:"file"`
|
||||
Log *shared.Log `ocisConfig:"log"`
|
||||
Debug Debug `ocisConfig:"debug"`
|
||||
HTTP HTTP `ocisConfig:"http"`
|
||||
Server Server `ocisConfig:"server"`
|
||||
Tracing Tracing `ocisConfig:"tracing"`
|
||||
Reva Reva `ocisConfig:"reva"`
|
||||
TokenManager TokenManager `ocisConfig:"token_manager"`
|
||||
Spaces Spaces `ocisConfig:"spaces"`
|
||||
|
||||
Context context.Context
|
||||
Supervised bool
|
||||
@@ -76,3 +74,34 @@ type Config struct {
|
||||
func New() *Config {
|
||||
return &Config{}
|
||||
}
|
||||
|
||||
func DefaultConfig() *Config {
|
||||
return &Config{
|
||||
Debug: Debug{
|
||||
Addr: "127.0.0.1:9124",
|
||||
Token: "",
|
||||
},
|
||||
HTTP: HTTP{
|
||||
Addr: "127.0.0.1:9120",
|
||||
Namespace: "com.owncloud.web",
|
||||
Root: "/graph",
|
||||
},
|
||||
Server: Server{},
|
||||
Tracing: Tracing{
|
||||
Enabled: false,
|
||||
Type: "jaeger",
|
||||
Service: "graph",
|
||||
},
|
||||
Reva: Reva{
|
||||
Address: "127.0.0.1:9142",
|
||||
},
|
||||
TokenManager: TokenManager{
|
||||
JWTSecret: "Pive-Fumkiu4",
|
||||
},
|
||||
Spaces: Spaces{
|
||||
WebDavBase: "https://localhost:9200",
|
||||
WebDavPath: "/dav/spaces/",
|
||||
DefaultQuota: "1000000000",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
115
graph/pkg/config/mappings.go
Normal file
115
graph/pkg/config/mappings.go
Normal file
@@ -0,0 +1,115 @@
|
||||
package config
|
||||
|
||||
import "github.com/owncloud/ocis/ocis-pkg/shared"
|
||||
|
||||
// GetEnv fetches a list of known env variables for this extension. It is to be used by gookit, as it provides a list
|
||||
// with all the environment variables an extension supports.
|
||||
func GetEnv(cfg *Config) []string {
|
||||
var r = make([]string, len(structMappings(cfg)))
|
||||
for i := range structMappings(cfg) {
|
||||
r = append(r, structMappings(cfg)[i].EnvVars...)
|
||||
}
|
||||
|
||||
return r
|
||||
}
|
||||
|
||||
// StructMappings binds a set of environment variables to a destination on cfg. Iterating over this set and editing the
|
||||
// Destination value of a binding will alter the original value, as it is a pointer to its memory address. This lets
|
||||
// us propagate changes easier.
|
||||
func StructMappings(cfg *Config) []shared.EnvBinding {
|
||||
return structMappings(cfg)
|
||||
}
|
||||
|
||||
// structMappings binds a set of environment variables to a destination on cfg.
|
||||
func structMappings(cfg *Config) []shared.EnvBinding {
|
||||
return []shared.EnvBinding{
|
||||
{
|
||||
EnvVars: []string{"GRAPH_CONFIG_FILE"},
|
||||
Destination: &cfg.File,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_LOG_LEVEL", "GRAPH_LOG_LEVEL"},
|
||||
Destination: &cfg.Log.Level,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_LOG_PRETTY", "GRAPH_LOG_PRETTY"},
|
||||
Destination: &cfg.Log.Pretty,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_LOG_COLOR", "GRAPH_LOG_COLOR"},
|
||||
Destination: &cfg.Log.Color,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_LOG_FILE", "GRAPH_LOG_FILE"},
|
||||
Destination: &cfg.Log.File,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_TRACING_ENABLED", "GRAPH_TRACING_ENABLED"},
|
||||
Destination: &cfg.Tracing.Enabled,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_TRACING_TYPE", "GRAPH_TRACING_TYPE"},
|
||||
Destination: &cfg.Tracing.Type,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_TRACING_ENDPOINT", "GRAPH_TRACING_ENDPOINT"},
|
||||
Destination: &cfg.Tracing.Endpoint,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_TRACING_COLLECTOR", "GRAPH_TRACING_COLLECTOR"},
|
||||
Destination: &cfg.Tracing.Collector,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"GRAPH_TRACING_SERVICE"},
|
||||
Destination: &cfg.Tracing.Service,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"GRAPH_DEBUG_ADDR"},
|
||||
Destination: &cfg.Debug.Addr,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"GRAPH_DEBUG_TOKEN"},
|
||||
Destination: &cfg.Debug.Token,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"GRAPH_DEBUG_PPROF"},
|
||||
Destination: &cfg.Debug.Pprof,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"GRAPH_DEBUG_ZPAGES"},
|
||||
Destination: &cfg.Debug.Zpages,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"GRAPH_HTTP_ADDR"},
|
||||
Destination: &cfg.HTTP.Addr,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"GRAPH_HTTP_ROOT"},
|
||||
Destination: &cfg.HTTP.Root,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"GRAPH_HTTP_NAMESPACE"},
|
||||
Destination: &cfg.HTTP.Namespace,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_URL", "GRAPH_SPACES_WEBDAV_BASE"},
|
||||
Destination: &cfg.Spaces.WebDavBase,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"GRAPH_SPACES_WEBDAV_PATH"},
|
||||
Destination: &cfg.Spaces.WebDavPath,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"GRAPH_SPACES_DEFAULT_QUOTA"},
|
||||
Destination: &cfg.Spaces.DefaultQuota,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_JWT_SECRET", "GRAPH_JWT_SECRET"},
|
||||
Destination: &cfg.TokenManager.JWTSecret,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"REVA_GATEWAY"},
|
||||
Destination: &cfg.Reva.Address,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -1,186 +0,0 @@
|
||||
package flagset
|
||||
|
||||
import (
|
||||
"github.com/owncloud/ocis/graph/pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/flags"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
// RootWithConfig applies cfg to the root flagset
|
||||
func RootWithConfig(cfg *config.Config) []cli.Flag {
|
||||
return []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "config-file",
|
||||
Value: flags.OverrideDefaultString(cfg.File, ""),
|
||||
Usage: "Path to config file",
|
||||
EnvVars: []string{"GRAPH_CONFIG_FILE"},
|
||||
Destination: &cfg.File,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "log-level",
|
||||
Usage: "Set logging level",
|
||||
EnvVars: []string{"GRAPH_LOG_LEVEL", "OCIS_LOG_LEVEL"},
|
||||
Destination: &cfg.Log.Level,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "log-pretty",
|
||||
Usage: "Enable pretty logging",
|
||||
EnvVars: []string{"GRAPH_LOG_PRETTY", "OCIS_LOG_PRETTY"},
|
||||
Destination: &cfg.Log.Pretty,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "log-color",
|
||||
Usage: "Enable colored logging",
|
||||
EnvVars: []string{"GRAPH_LOG_COLOR", "OCIS_LOG_COLOR"},
|
||||
Destination: &cfg.Log.Color,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// HealthWithConfig applies cfg to the root flagset
|
||||
func HealthWithConfig(cfg *config.Config) []cli.Flag {
|
||||
return []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "debug-addr",
|
||||
Value: flags.OverrideDefaultString(cfg.Debug.Addr, "127.0.0.1:9124"),
|
||||
Usage: "Address to debug endpoint",
|
||||
EnvVars: []string{"GRAPH_DEBUG_ADDR"},
|
||||
Destination: &cfg.Debug.Addr,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// ServerWithConfig applies cfg to the root flagset
|
||||
func ServerWithConfig(cfg *config.Config) []cli.Flag {
|
||||
return []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "log-file",
|
||||
Usage: "Enable log to file",
|
||||
EnvVars: []string{"GRAPH_LOG_FILE", "OCIS_LOG_FILE"},
|
||||
Destination: &cfg.Log.File,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "tracing-enabled",
|
||||
Usage: "Enable sending traces",
|
||||
EnvVars: []string{"GRAPH_TRACING_ENABLED", "OCIS_TRACING_ENABLED"},
|
||||
Destination: &cfg.Tracing.Enabled,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "tracing-type",
|
||||
Value: flags.OverrideDefaultString(cfg.Tracing.Type, "jaeger"),
|
||||
Usage: "Tracing backend type",
|
||||
EnvVars: []string{"GRAPH_TRACING_TYPE", "OCIS_TRACING_TYPE"},
|
||||
Destination: &cfg.Tracing.Type,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "tracing-endpoint",
|
||||
Value: flags.OverrideDefaultString(cfg.Tracing.Endpoint, ""),
|
||||
Usage: "Endpoint for the agent",
|
||||
EnvVars: []string{"GRAPH_TRACING_ENDPOINT", "OCIS_TRACING_ENDPOINT"},
|
||||
Destination: &cfg.Tracing.Endpoint,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "tracing-collector",
|
||||
Value: flags.OverrideDefaultString(cfg.Tracing.Collector, ""),
|
||||
Usage: "Endpoint for the collector",
|
||||
EnvVars: []string{"GRAPH_TRACING_COLLECTOR", "OCIS_TRACING_COLLECTOR"},
|
||||
Destination: &cfg.Tracing.Collector,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "tracing-service",
|
||||
Value: flags.OverrideDefaultString(cfg.Tracing.Service, "graph"),
|
||||
Usage: "Service name for tracing",
|
||||
EnvVars: []string{"GRAPH_TRACING_SERVICE"},
|
||||
Destination: &cfg.Tracing.Service,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "debug-addr",
|
||||
Value: flags.OverrideDefaultString(cfg.Debug.Addr, "127.0.0.1:9124"),
|
||||
Usage: "Address to bind debug server",
|
||||
EnvVars: []string{"GRAPH_DEBUG_ADDR"},
|
||||
Destination: &cfg.Debug.Addr,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "debug-token",
|
||||
Value: flags.OverrideDefaultString(cfg.Debug.Token, ""),
|
||||
Usage: "Token to grant metrics access",
|
||||
EnvVars: []string{"GRAPH_DEBUG_TOKEN"},
|
||||
Destination: &cfg.Debug.Token,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "debug-pprof",
|
||||
Usage: "Enable pprof debugging",
|
||||
EnvVars: []string{"GRAPH_DEBUG_PPROF"},
|
||||
Destination: &cfg.Debug.Pprof,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "debug-zpages",
|
||||
Usage: "Enable zpages debugging",
|
||||
EnvVars: []string{"GRAPH_DEBUG_ZPAGES"},
|
||||
Destination: &cfg.Debug.Zpages,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "http-addr",
|
||||
Value: flags.OverrideDefaultString(cfg.HTTP.Addr, "127.0.0.1:9120"),
|
||||
Usage: "Address to bind http server",
|
||||
EnvVars: []string{"GRAPH_HTTP_ADDR"},
|
||||
Destination: &cfg.HTTP.Addr,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "http-root",
|
||||
Value: flags.OverrideDefaultString(cfg.HTTP.Root, "/graph"),
|
||||
Usage: "Root path of http server",
|
||||
EnvVars: []string{"GRAPH_HTTP_ROOT"},
|
||||
Destination: &cfg.HTTP.Root,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "http-namespace",
|
||||
Value: flags.OverrideDefaultString(cfg.HTTP.Namespace, "com.owncloud.web"),
|
||||
Usage: "Set the base namespace for the http service for service discovery",
|
||||
EnvVars: []string{"GRAPH_HTTP_NAMESPACE"},
|
||||
Destination: &cfg.HTTP.Namespace,
|
||||
},
|
||||
|
||||
&cli.StringFlag{
|
||||
Name: "spaces-webdav-base",
|
||||
Value: flags.OverrideDefaultString(cfg.Spaces.WebDavBase, "https://localhost:9200"),
|
||||
Usage: "spaces webdav base URL to use when rendering drive WabDAV URLs",
|
||||
EnvVars: []string{"GRAPH_SPACES_WEBDAV_BASE", "OCIS_URL"},
|
||||
Destination: &cfg.Spaces.WebDavBase,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "spaces-webdav-path",
|
||||
Value: flags.OverrideDefaultString(cfg.Spaces.WebDavPath, "/dav/spaces/"),
|
||||
Usage: "spaces webdav path to use when rendering drive WabDAV URLs",
|
||||
EnvVars: []string{"GRAPH_SPACES_WEBDAV_PATH"},
|
||||
Destination: &cfg.Spaces.WebDavPath,
|
||||
},
|
||||
|
||||
&cli.StringFlag{
|
||||
Name: "default-space-quota",
|
||||
Value: flags.OverrideDefaultString(cfg.Spaces.DefaultQuota, "1000000000"),
|
||||
Usage: "default quota used for all spaces if no custom quota was given",
|
||||
EnvVars: []string{"GRAPH_SPACES_DEFAULT_QUOTA"},
|
||||
Destination: &cfg.Spaces.DefaultQuota,
|
||||
},
|
||||
|
||||
&cli.StringFlag{
|
||||
Name: "jwt-secret",
|
||||
Value: flags.OverrideDefaultString(cfg.TokenManager.JWTSecret, "Pive-Fumkiu4"),
|
||||
Usage: "Used to validate the reva access JWT, should equal reva's jwt-secret",
|
||||
EnvVars: []string{"GRAPH_JWT_SECRET", "OCIS_JWT_SECRET"},
|
||||
Destination: &cfg.TokenManager.JWTSecret,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "reva-gateway-addr",
|
||||
Value: flags.OverrideDefaultString(cfg.Reva.Address, "127.0.0.1:9142"),
|
||||
Usage: "Address of REVA gateway endpoint",
|
||||
EnvVars: []string{"REVA_GATEWAY"},
|
||||
Destination: &cfg.Reva.Address,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "extensions",
|
||||
Usage: "Run specific extensions during supervised mode. This flag is set by the runtime",
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
if err := command.Execute(config.New()); err != nil {
|
||||
if err := command.Execute(config.DefaultConfig()); err != nil {
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
"net/http"
|
||||
|
||||
"github.com/owncloud/ocis/idp/pkg/config"
|
||||
"github.com/owncloud/ocis/idp/pkg/flagset"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
@@ -14,7 +13,9 @@ func Health(cfg *config.Config) *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "health",
|
||||
Usage: "Check health status",
|
||||
Flags: flagset.HealthWithConfig(cfg),
|
||||
Before: func(c *cli.Context) error {
|
||||
return ParseConfig(c, cfg)
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
logger := NewLogger(cfg)
|
||||
|
||||
|
||||
@@ -3,15 +3,13 @@ package command
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/shared"
|
||||
|
||||
"github.com/owncloud/ocis/idp/pkg/config"
|
||||
"github.com/owncloud/ocis/idp/pkg/flagset"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/log"
|
||||
"github.com/owncloud/ocis/ocis-pkg/sync"
|
||||
"github.com/owncloud/ocis/ocis-pkg/version"
|
||||
"github.com/spf13/viper"
|
||||
"github.com/thejerf/suture/v4"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
@@ -23,16 +21,12 @@ func Execute(cfg *config.Config) error {
|
||||
Version: version.String,
|
||||
Usage: "Serve IDP API for oCIS",
|
||||
Compiled: version.Compiled(),
|
||||
|
||||
Authors: []*cli.Author{
|
||||
{
|
||||
Name: "ownCloud GmbH",
|
||||
Email: "support@owncloud.com",
|
||||
},
|
||||
},
|
||||
|
||||
Flags: flagset.RootWithConfig(cfg),
|
||||
|
||||
Before: func(c *cli.Context) error {
|
||||
cfg.Service.Version = version.String
|
||||
return nil
|
||||
@@ -69,49 +63,30 @@ func NewLogger(cfg *config.Config) log.Logger {
|
||||
)
|
||||
}
|
||||
|
||||
// ParseConfig load configuration for every extension
|
||||
// ParseConfig loads idp configuration from known paths.
|
||||
func ParseConfig(c *cli.Context, cfg *config.Config) error {
|
||||
sync.ParsingViperConfig.Lock()
|
||||
defer sync.ParsingViperConfig.Unlock()
|
||||
logger := NewLogger(cfg)
|
||||
|
||||
viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
|
||||
viper.SetEnvPrefix("IDP")
|
||||
viper.AutomaticEnv()
|
||||
|
||||
if c.IsSet("config-file") {
|
||||
viper.SetConfigFile(c.String("config-file"))
|
||||
} else {
|
||||
viper.SetConfigName("idp")
|
||||
|
||||
viper.AddConfigPath("/etc/ocis")
|
||||
viper.AddConfigPath("$HOME/.ocis")
|
||||
viper.AddConfigPath("./config")
|
||||
conf, err := ociscfg.BindSourcesToStructs("idp", cfg)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := viper.ReadInConfig(); err != nil {
|
||||
switch err.(type) {
|
||||
case viper.ConfigFileNotFoundError:
|
||||
logger.Debug().
|
||||
Msg("no config found on preconfigured location")
|
||||
case viper.UnsupportedConfigError:
|
||||
logger.Fatal().
|
||||
Err(err).
|
||||
Msg("unsupported config type")
|
||||
default:
|
||||
logger.Fatal().
|
||||
Err(err).
|
||||
Msg("failed to read config")
|
||||
// provide with defaults for shared logging, since we need a valid destination address for BindEnv.
|
||||
if cfg.Log == nil && cfg.Commons != nil && cfg.Commons.Log != nil {
|
||||
cfg.Log = &shared.Log{
|
||||
Level: cfg.Commons.Log.Level,
|
||||
Pretty: cfg.Commons.Log.Pretty,
|
||||
Color: cfg.Commons.Log.Color,
|
||||
File: cfg.Commons.Log.File,
|
||||
}
|
||||
} else if cfg.Log == nil && cfg.Commons == nil {
|
||||
cfg.Log = &shared.Log{}
|
||||
}
|
||||
|
||||
if err := viper.Unmarshal(&cfg); err != nil {
|
||||
logger.Fatal().
|
||||
Err(err).
|
||||
Msg("failed to parse config")
|
||||
}
|
||||
// load all env variables relevant to the config in the current context.
|
||||
conf.LoadOSEnv(config.GetEnv(cfg), false)
|
||||
|
||||
return nil
|
||||
bindings := config.StructMappings(cfg)
|
||||
return ociscfg.BindEnv(conf, bindings)
|
||||
}
|
||||
|
||||
// SutureService allows for the idp command to be embedded and supervised by a suture supervisor tree.
|
||||
@@ -121,10 +96,7 @@ type SutureService struct {
|
||||
|
||||
// NewSutureService creates a new idp.SutureService
|
||||
func NewSutureService(cfg *ociscfg.Config) suture.Service {
|
||||
if cfg.Mode == 0 {
|
||||
cfg.IDP.Supervised = true
|
||||
}
|
||||
cfg.IDP.Log.File = cfg.Log.File
|
||||
cfg.IDP.Commons = cfg.Commons
|
||||
return SutureService{
|
||||
cfg: cfg.IDP,
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
|
||||
"github.com/oklog/run"
|
||||
"github.com/owncloud/ocis/idp/pkg/config"
|
||||
"github.com/owncloud/ocis/idp/pkg/flagset"
|
||||
"github.com/owncloud/ocis/idp/pkg/metrics"
|
||||
"github.com/owncloud/ocis/idp/pkg/server/debug"
|
||||
"github.com/owncloud/ocis/idp/pkg/server/http"
|
||||
@@ -20,31 +19,15 @@ func Server(cfg *config.Config) *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "server",
|
||||
Usage: "Start integrated server",
|
||||
Flags: flagset.ServerWithConfig(cfg),
|
||||
Before: func(ctx *cli.Context) error {
|
||||
logger := NewLogger(cfg)
|
||||
if err := ParseConfig(ctx, cfg); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if cfg.HTTP.Root != "/" {
|
||||
cfg.HTTP.Root = strings.TrimSuffix(cfg.HTTP.Root, "/")
|
||||
}
|
||||
|
||||
// StringSliceFlag doesn't support Destination
|
||||
// UPDATE Destination on string flags supported. Wait for https://github.com/urfave/cli/pull/1078 to get to micro/cli
|
||||
if len(ctx.StringSlice("trusted-proxy")) > 0 {
|
||||
cfg.IDP.TrustedProxy = ctx.StringSlice("trusted-proxy")
|
||||
}
|
||||
|
||||
if len(ctx.StringSlice("allow-scope")) > 0 {
|
||||
cfg.IDP.AllowScope = ctx.StringSlice("allow-scope")
|
||||
}
|
||||
|
||||
if len(ctx.StringSlice("signing-private-key")) > 0 {
|
||||
cfg.IDP.SigningPrivateKeyFiles = ctx.StringSlice("signing-private-key")
|
||||
}
|
||||
|
||||
if !cfg.Supervised {
|
||||
return ParseConfig(ctx, cfg)
|
||||
}
|
||||
logger.Debug().Str("service", "idp").Msg("ignoring config file parsing when running supervised")
|
||||
return nil
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
|
||||
@@ -8,7 +8,6 @@ import (
|
||||
|
||||
tw "github.com/olekukonko/tablewriter"
|
||||
"github.com/owncloud/ocis/idp/pkg/config"
|
||||
"github.com/owncloud/ocis/idp/pkg/flagset"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
@@ -17,7 +16,9 @@ func PrintVersion(cfg *config.Config) *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "version",
|
||||
Usage: "Print the versions of the running instances",
|
||||
Flags: flagset.ListIDPWithConfig(cfg),
|
||||
Before: func(c *cli.Context) error {
|
||||
return ParseConfig(c, cfg)
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
reg := registry.GetRegistry()
|
||||
services, err := reg.GetService(cfg.Service.Namespace + "." + cfg.Service.Name)
|
||||
|
||||
@@ -2,82 +2,113 @@ package config
|
||||
|
||||
import (
|
||||
"context"
|
||||
"path"
|
||||
|
||||
"github.com/libregraph/lico/bootstrap"
|
||||
"github.com/owncloud/ocis/ocis-pkg/shared"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/config/defaults"
|
||||
)
|
||||
|
||||
// Log defines the available logging configuration.
|
||||
type Log struct {
|
||||
Level string
|
||||
Pretty bool
|
||||
Color bool
|
||||
File string
|
||||
}
|
||||
|
||||
// Debug defines the available debug configuration.
|
||||
type Debug struct {
|
||||
Addr string
|
||||
Token string
|
||||
Pprof bool
|
||||
Zpages bool
|
||||
Addr string `ocisConfig:"addr"`
|
||||
Token string `ocisConfig:"token"`
|
||||
Pprof bool `ocisConfig:"pprof"`
|
||||
Zpages bool `ocisConfig:"zpages"`
|
||||
}
|
||||
|
||||
// HTTP defines the available http configuration.
|
||||
type HTTP struct {
|
||||
Addr string
|
||||
Root string
|
||||
TLSCert string
|
||||
TLSKey string
|
||||
TLS bool
|
||||
Addr string `ocisConfig:"addr"`
|
||||
Root string `ocisConfig:"root"`
|
||||
TLSCert string `ocisConfig:"tls_cert"`
|
||||
TLSKey string `ocisConfig:"tls_key"`
|
||||
TLS bool `ocisConfig:"tls"`
|
||||
}
|
||||
|
||||
// Ldap defines the available LDAP configuration.
|
||||
type Ldap struct {
|
||||
URI string
|
||||
BindDN string
|
||||
BindPassword string
|
||||
BaseDN string
|
||||
Scope string
|
||||
LoginAttribute string
|
||||
EmailAttribute string
|
||||
NameAttribute string
|
||||
UUIDAttribute string
|
||||
UUIDAttributeType string
|
||||
Filter string
|
||||
URI string `ocisConfig:"uri"`
|
||||
BindDN string `ocisConfig:"bind_dn"`
|
||||
BindPassword string `ocisConfig:"bind_password"`
|
||||
BaseDN string `ocisConfig:"base_dn"`
|
||||
Scope string `ocisConfig:"scope"`
|
||||
LoginAttribute string `ocisConfig:"login_attribute"`
|
||||
EmailAttribute string `ocisConfig:"email_attribute"`
|
||||
NameAttribute string `ocisConfig:"name_attribute"`
|
||||
UUIDAttribute string `ocisConfig:"uuid_attribute"`
|
||||
UUIDAttributeType string `ocisConfig:"uuid_attribute_type"`
|
||||
Filter string `ocisConfig:"filter"`
|
||||
}
|
||||
|
||||
// Service defines the available service configuration.
|
||||
type Service struct {
|
||||
Name string
|
||||
Namespace string
|
||||
Version string
|
||||
Name string `ocisConfig:"name"`
|
||||
Namespace string `ocisConfig:"namespace"`
|
||||
Version string `ocisConfig:"version"`
|
||||
}
|
||||
|
||||
// Tracing defines the available tracing configuration.
|
||||
type Tracing struct {
|
||||
Enabled bool
|
||||
Type string
|
||||
Endpoint string
|
||||
Collector string
|
||||
Service string
|
||||
Enabled bool `ocisConfig:"enabled"`
|
||||
Type string `ocisConfig:"type"`
|
||||
Endpoint string `ocisConfig:"endpoint"`
|
||||
Collector string `ocisConfig:"collector"`
|
||||
Service string `ocisConfig:"service"`
|
||||
}
|
||||
|
||||
// Asset defines the available asset configuration.
|
||||
type Asset struct {
|
||||
Path string
|
||||
Path string `ocisConfig:"asset"`
|
||||
}
|
||||
|
||||
type Settings struct {
|
||||
Iss string `ocisConfig:"iss"`
|
||||
IdentityManager string `ocisConfig:"identity_manager"`
|
||||
URIBasePath string `ocisConfig:"uri_base_path"`
|
||||
SignInURI string `ocisConfig:"sign_in_uri"`
|
||||
SignedOutURI string `ocisConfig:"signed_out_uri"`
|
||||
AuthorizationEndpointURI string `ocisConfig:"authorization_endpoint_uri"`
|
||||
EndsessionEndpointURI string `ocisConfig:"end_session_endpoint_uri"`
|
||||
Insecure bool `ocisConfig:"insecure"`
|
||||
TrustedProxy []string `ocisConfig:"trusted_proxy"`
|
||||
AllowScope []string `ocisConfig:"allow_scope"`
|
||||
AllowClientGuests bool `ocisConfig:"allow_client_guests"`
|
||||
AllowDynamicClientRegistration bool `ocisConfig:"allow_dynamic_client_registration"`
|
||||
EncryptionSecretFile string `ocisConfig:"encrypt_secret_file"`
|
||||
Listen string `ocisConfig:"listen"`
|
||||
IdentifierClientDisabled bool `ocisConfig:"identifier_client_disabled"`
|
||||
IdentifierClientPath string `ocisConfig:"identifier_client_path"`
|
||||
IdentifierRegistrationConf string `ocisConfig:"identifier_registration_conf"`
|
||||
IdentifierScopesConf string `ocisConfig:"identifier_scopes_conf"`
|
||||
IdentifierDefaultBannerLogo string `ocisConfig:"identifier_default_banner_logo"`
|
||||
IdentifierDefaultSignInPageText string `ocisConfig:"identifier_default_sign_in_page_text"`
|
||||
IdentifierDefaultUsernameHintText string `ocisConfig:"identifier_default_username_hint_text"`
|
||||
SigningKid string `ocisConfig:"sign_in_kid"`
|
||||
SigningMethod string `ocisConfig:"sign_in_method"`
|
||||
SigningPrivateKeyFiles []string `ocisConfig:"sign_in_private_key_files"`
|
||||
ValidationKeysPath string `ocisConfig:"validation_keys_path"`
|
||||
CookieBackendURI string `ocisConfig:"cookie_backend_uri"`
|
||||
CookieNames []string `ocisConfig:"cookie_names"`
|
||||
AccessTokenDurationSeconds uint64 `ocisConfig:"access_token_duration_seconds"`
|
||||
IDTokenDurationSeconds uint64 `ocisConfig:"id_token_duration_seconds"`
|
||||
RefreshTokenDurationSeconds uint64 `ocisConfig:"refresh_token_duration_seconds"`
|
||||
DyamicClientSecretDurationSeconds uint64 `ocisConfig:"dynamic_client_secret_duration_seconds"`
|
||||
}
|
||||
|
||||
// Config combines all available configuration parts.
|
||||
type Config struct {
|
||||
File string
|
||||
Log Log
|
||||
Debug Debug
|
||||
HTTP HTTP
|
||||
Tracing Tracing
|
||||
Asset Asset
|
||||
IDP bootstrap.Settings
|
||||
Ldap Ldap
|
||||
Service Service
|
||||
*shared.Commons
|
||||
|
||||
File string `ocisConfig:"file"`
|
||||
Log *shared.Log `ocisConfig:"log"`
|
||||
Debug Debug `ocisConfig:"debug"`
|
||||
HTTP HTTP `ocisConfig:"http"`
|
||||
Tracing Tracing `ocisConfig:"tracing"`
|
||||
Asset Asset `ocisConfig:"asset"`
|
||||
IDP Settings `ocisConfig:"idp"`
|
||||
Ldap Ldap `ocisConfig:"ldap"`
|
||||
Service Service `ocisConfig:"service"`
|
||||
|
||||
Context context.Context
|
||||
Supervised bool
|
||||
@@ -87,3 +118,75 @@ type Config struct {
|
||||
func New() *Config {
|
||||
return &Config{}
|
||||
}
|
||||
|
||||
func DefaultConfig() *Config {
|
||||
return &Config{
|
||||
Debug: Debug{
|
||||
Addr: "127.0.0.1:9134",
|
||||
},
|
||||
HTTP: HTTP{
|
||||
Addr: "127.0.0.1:9130",
|
||||
Root: "/",
|
||||
TLSCert: path.Join(defaults.BaseDataPath(), "idp", "server.crt"),
|
||||
TLSKey: path.Join(defaults.BaseDataPath(), "idp", "server.key"),
|
||||
TLS: false,
|
||||
},
|
||||
Tracing: Tracing{
|
||||
Type: "jaeger",
|
||||
Endpoint: "",
|
||||
Collector: "",
|
||||
Service: "idp",
|
||||
},
|
||||
Asset: Asset{},
|
||||
IDP: Settings{
|
||||
Iss: "https://localhost:9200",
|
||||
IdentityManager: "ldap",
|
||||
URIBasePath: "",
|
||||
SignInURI: "",
|
||||
SignedOutURI: "",
|
||||
AuthorizationEndpointURI: "",
|
||||
EndsessionEndpointURI: "",
|
||||
Insecure: false,
|
||||
TrustedProxy: nil,
|
||||
AllowScope: nil,
|
||||
AllowClientGuests: false,
|
||||
AllowDynamicClientRegistration: false,
|
||||
EncryptionSecretFile: "",
|
||||
Listen: "",
|
||||
IdentifierClientDisabled: true,
|
||||
IdentifierClientPath: path.Join(defaults.BaseDataPath(), "idp"),
|
||||
IdentifierRegistrationConf: path.Join(defaults.BaseDataPath(), "idp", "identifier-registration.yaml"),
|
||||
IdentifierScopesConf: "",
|
||||
IdentifierDefaultBannerLogo: "",
|
||||
IdentifierDefaultSignInPageText: "",
|
||||
IdentifierDefaultUsernameHintText: "",
|
||||
SigningKid: "",
|
||||
SigningMethod: "PS256",
|
||||
SigningPrivateKeyFiles: nil,
|
||||
ValidationKeysPath: "",
|
||||
CookieBackendURI: "",
|
||||
CookieNames: nil,
|
||||
AccessTokenDurationSeconds: 60 * 10, // 10 minutes
|
||||
IDTokenDurationSeconds: 60 * 60, // 1 hour
|
||||
RefreshTokenDurationSeconds: 60 * 60 * 24 * 365 * 3, // 1 year
|
||||
DyamicClientSecretDurationSeconds: 0,
|
||||
},
|
||||
Ldap: Ldap{
|
||||
URI: "ldap://localhost:9125",
|
||||
BindDN: "cn=idp,ou=sysusers,dc=ocis,dc=test",
|
||||
BindPassword: "idp",
|
||||
BaseDN: "ou=users,dc=ocis,dc=test",
|
||||
Scope: "sub",
|
||||
LoginAttribute: "cn",
|
||||
EmailAttribute: "mail",
|
||||
NameAttribute: "sn",
|
||||
UUIDAttribute: "uid",
|
||||
UUIDAttributeType: "text",
|
||||
Filter: "(objectClass=posixaccount)",
|
||||
},
|
||||
Service: Service{
|
||||
Name: "idp",
|
||||
Namespace: "com.owncloud.web",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
243
idp/pkg/config/mappings.go
Normal file
243
idp/pkg/config/mappings.go
Normal file
@@ -0,0 +1,243 @@
|
||||
package config
|
||||
|
||||
import "github.com/owncloud/ocis/ocis-pkg/shared"
|
||||
|
||||
// GetEnv fetches a list of known env variables for this extension. It is to be used by gookit, as it provides a list
|
||||
// with all the environment variables an extension supports.
|
||||
func GetEnv(cfg *Config) []string {
|
||||
var r = make([]string, len(structMappings(cfg)))
|
||||
for i := range structMappings(cfg) {
|
||||
r = append(r, structMappings(cfg)[i].EnvVars...)
|
||||
}
|
||||
|
||||
return r
|
||||
}
|
||||
|
||||
// StructMappings binds a set of environment variables to a destination on cfg. Iterating over this set and editing the
|
||||
// Destination value of a binding will alter the original value, as it is a pointer to its memory address. This lets
|
||||
// us propagate changes easier.
|
||||
func StructMappings(cfg *Config) []shared.EnvBinding {
|
||||
return structMappings(cfg)
|
||||
}
|
||||
|
||||
// structMappings binds a set of environment variables to a destination on cfg.
|
||||
func structMappings(cfg *Config) []shared.EnvBinding {
|
||||
return []shared.EnvBinding{
|
||||
{
|
||||
EnvVars: []string{"OCIS_LOG_LEVEL", "IDP_LOG_LEVEL"},
|
||||
Destination: &cfg.Log.Level,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_LOG_PRETTY", "IDP_LOG_PRETTY"},
|
||||
Destination: &cfg.Log.Pretty,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_LOG_COLOR", "IDP_LOG_COLOR"},
|
||||
Destination: &cfg.Log.Color,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_LOG_FILE", "IDP_LOG_FILE"},
|
||||
Destination: &cfg.Log.File,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"IDP_CONFIG_FILE"},
|
||||
Destination: &cfg.File,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_TRACING_ENABLED", "IDP_TRACING_ENABLED"},
|
||||
Destination: &cfg.Tracing.Enabled,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_TRACING_TYPE", "IDP_TRACING_TYPE"},
|
||||
Destination: &cfg.Tracing.Type,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_TRACING_ENDPOINT", "IDP_TRACING_ENDPOINT"},
|
||||
Destination: &cfg.Tracing.Endpoint,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_TRACING_COLLECTOR", "IDP_TRACING_COLLECTOR"},
|
||||
Destination: &cfg.Tracing.Collector,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"IDP_TRACING_SERVICE"},
|
||||
Destination: &cfg.Tracing.Service,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"IDP_DEBUG_ADDR"},
|
||||
Destination: &cfg.Debug.Addr,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"IDP_DEBUG_TOKEN"},
|
||||
Destination: &cfg.Debug.Token,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"IDP_DEBUG_PPROF"},
|
||||
Destination: &cfg.Debug.Pprof,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"IDP_DEBUG_ZPAGES"},
|
||||
Destination: &cfg.Debug.Zpages,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"IDP_HTTP_ADDR"},
|
||||
Destination: &cfg.HTTP.Addr,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"IDP_HTTP_ROOT"},
|
||||
Destination: &cfg.HTTP.Root,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"IDP_HTTP_NAMESPACE"},
|
||||
Destination: &cfg.Service.Namespace,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"IDP_NAME"},
|
||||
Destination: &cfg.Service.Name,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"IDP_IDENTITY_MANAGER"},
|
||||
Destination: &cfg.IDP.IdentityManager,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"IDP_LDAP_URI"},
|
||||
Destination: &cfg.Ldap.URI,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"IDP_LDAP_BIND_DN"},
|
||||
Destination: &cfg.Ldap.BindDN,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"IDP_LDAP_BIND_PASSWORD"},
|
||||
Destination: &cfg.Ldap.BindPassword,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"IDP_LDAP_BASE_DN"},
|
||||
Destination: &cfg.Ldap.BaseDN,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"IDP_LDAP_SCOPE"},
|
||||
Destination: &cfg.Ldap.Scope,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"IDP_LDAP_LOGIN_ATTRIBUTE"},
|
||||
Destination: &cfg.Ldap.LoginAttribute,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"IDP_LDAP_EMAIL_ATTRIBUTE"},
|
||||
Destination: &cfg.Ldap.EmailAttribute,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"IDP_LDAP_NAME_ATTRIBUTE"},
|
||||
Destination: &cfg.Ldap.NameAttribute,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"IDP_LDAP_UUID_ATTRIBUTE"},
|
||||
Destination: &cfg.Ldap.UUIDAttribute,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"IDP_LDAP_UUID_ATTRIBUTE_TYPE"},
|
||||
Destination: &cfg.Ldap.UUIDAttributeType,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"IDP_LDAP_FILTER"},
|
||||
Destination: &cfg.Ldap.Filter,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"IDP_TRANSPORT_TLS_CERT"},
|
||||
Destination: &cfg.HTTP.TLSCert,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"IDP_TRANSPORT_TLS_KEY"},
|
||||
Destination: &cfg.HTTP.TLSKey,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_URL", "IDP_ISS"}, // IDP_ISS takes precedence over OCIS_URL
|
||||
Destination: &cfg.IDP.Iss,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"IDP_SIGNING_KID"},
|
||||
Destination: &cfg.IDP.SigningKid,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"IDP_VALIDATION_KEYS_PATH"},
|
||||
Destination: &cfg.IDP.ValidationKeysPath,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"IDP_ENCRYPTION_SECRET"},
|
||||
Destination: &cfg.IDP.EncryptionSecretFile,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"IDP_SIGNING_METHOD"},
|
||||
Destination: &cfg.IDP.SigningMethod,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"IDP_URI_BASE_PATH"},
|
||||
Destination: &cfg.IDP.URIBasePath,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"IDP_SIGN_IN_URI"},
|
||||
Destination: &cfg.IDP.SignInURI,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"IDP_SIGN_OUT_URI"},
|
||||
Destination: &cfg.IDP.SignedOutURI,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"IDP_ENDPOINT_URI"},
|
||||
Destination: &cfg.IDP.AuthorizationEndpointURI,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"IDP_ENDSESSION_ENDPOINT_URI"},
|
||||
Destination: &cfg.IDP.EndsessionEndpointURI,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"IDP_ASSET_PATH"},
|
||||
Destination: &cfg.Asset.Path,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"IDP_IDENTIFIER_CLIENT_PATH"},
|
||||
Destination: &cfg.IDP.IdentifierClientPath,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"IDP_IDENTIFIER_REGISTRATION_CONF"},
|
||||
Destination: &cfg.IDP.IdentifierRegistrationConf,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"IDP_IDENTIFIER_SCOPES_CONF"},
|
||||
Destination: &cfg.IDP.IdentifierScopesConf,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"IDP_INSECURE"},
|
||||
Destination: &cfg.IDP.Insecure,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"IDP_TLS"},
|
||||
Destination: &cfg.HTTP.TLS,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"IDP_ALLOW_CLIENT_GUESTS"},
|
||||
Destination: &cfg.IDP.AllowClientGuests,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"IDP_ALLOW_DYNAMIC_CLIENT_REGISTRATION"},
|
||||
Destination: &cfg.IDP.AllowDynamicClientRegistration,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"IDP_DISABLE_IDENTIFIER_WEBAPP"},
|
||||
Destination: &cfg.IDP.IdentifierClientDisabled,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"IDP_ACCESS_TOKEN_EXPIRATION"},
|
||||
Destination: &cfg.IDP.AccessTokenDurationSeconds,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"IDP_ID_TOKEN_EXPIRATION"},
|
||||
Destination: &cfg.IDP.IDTokenDurationSeconds,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"IDP_REFRESH_TOKEN_EXPIRATION"},
|
||||
Destination: &cfg.IDP.RefreshTokenDurationSeconds,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -1,446 +0,0 @@
|
||||
package flagset
|
||||
|
||||
import (
|
||||
"path"
|
||||
|
||||
"github.com/owncloud/ocis/idp/pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/config/defaults"
|
||||
"github.com/owncloud/ocis/ocis-pkg/flags"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
// RootWithConfig applies cfg to the root flagset
|
||||
func RootWithConfig(cfg *config.Config) []cli.Flag {
|
||||
return []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "log-level",
|
||||
Usage: "Set logging level",
|
||||
EnvVars: []string{"IDP_LOG_LEVEL", "OCIS_LOG_LEVEL"},
|
||||
Destination: &cfg.Log.Level,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "log-pretty",
|
||||
Usage: "Enable pretty logging",
|
||||
EnvVars: []string{"IDP_LOG_PRETTY", "OCIS_LOG_PRETTY"},
|
||||
Destination: &cfg.Log.Pretty,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "log-color",
|
||||
Usage: "Enable colored logging",
|
||||
EnvVars: []string{"IDP_LOG_COLOR", "OCIS_LOG_COLOR"},
|
||||
Destination: &cfg.Log.Color,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// HealthWithConfig applies cfg to the root flagset
|
||||
func HealthWithConfig(cfg *config.Config) []cli.Flag {
|
||||
return []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "debug-addr",
|
||||
Value: flags.OverrideDefaultString(cfg.Debug.Addr, "127.0.0.1:9134"),
|
||||
Usage: "Address to debug endpoint",
|
||||
EnvVars: []string{"IDP_DEBUG_ADDR"},
|
||||
Destination: &cfg.Debug.Addr,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// ServerWithConfig applies cfg to the root flagset
|
||||
func ServerWithConfig(cfg *config.Config) []cli.Flag {
|
||||
return []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "log-file",
|
||||
Usage: "Enable log to file",
|
||||
EnvVars: []string{"IDP_LOG_FILE", "OCIS_LOG_FILE"},
|
||||
Destination: &cfg.Log.File,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "config-file",
|
||||
Value: flags.OverrideDefaultString(cfg.File, ""),
|
||||
Usage: "Path to config file",
|
||||
EnvVars: []string{"IDP_CONFIG_FILE"},
|
||||
Destination: &cfg.File,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "tracing-enabled",
|
||||
Usage: "Enable sending traces",
|
||||
EnvVars: []string{"IDP_TRACING_ENABLED", "OCIS_TRACING_ENABLED"},
|
||||
Destination: &cfg.Tracing.Enabled,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "tracing-type",
|
||||
Value: flags.OverrideDefaultString(cfg.Tracing.Type, "jaeger"),
|
||||
Usage: "Tracing backend type",
|
||||
EnvVars: []string{"IDP_TRACING_TYPE", "OCIS_TRACING_TYPE"},
|
||||
Destination: &cfg.Tracing.Type,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "tracing-endpoint",
|
||||
Value: flags.OverrideDefaultString(cfg.Tracing.Endpoint, ""),
|
||||
Usage: "Endpoint for the agent",
|
||||
EnvVars: []string{"IDP_TRACING_ENDPOINT", "OCIS_TRACING_ENDPOINT"},
|
||||
Destination: &cfg.Tracing.Endpoint,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "tracing-collector",
|
||||
Value: flags.OverrideDefaultString(cfg.Tracing.Collector, ""),
|
||||
Usage: "Endpoint for the collector",
|
||||
EnvVars: []string{"IDP_TRACING_COLLECTOR", "OCIS_TRACING_COLLECTOR"},
|
||||
Destination: &cfg.Tracing.Collector,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "tracing-service",
|
||||
Value: flags.OverrideDefaultString(cfg.Tracing.Service, "idp"),
|
||||
Usage: "Service name for tracing",
|
||||
EnvVars: []string{"IDP_TRACING_SERVICE"},
|
||||
Destination: &cfg.Tracing.Service,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "debug-addr",
|
||||
Value: flags.OverrideDefaultString(cfg.Debug.Addr, "127.0.0.1:9134"),
|
||||
Usage: "Address to bind debug server",
|
||||
EnvVars: []string{"IDP_DEBUG_ADDR"},
|
||||
Destination: &cfg.Debug.Addr,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "debug-token",
|
||||
Value: flags.OverrideDefaultString(cfg.Debug.Token, ""),
|
||||
Usage: "Token to grant metrics access",
|
||||
EnvVars: []string{"IDP_DEBUG_TOKEN"},
|
||||
Destination: &cfg.Debug.Token,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "debug-pprof",
|
||||
Usage: "Enable pprof debugging",
|
||||
EnvVars: []string{"IDP_DEBUG_PPROF"},
|
||||
Destination: &cfg.Debug.Pprof,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "debug-zpages",
|
||||
Usage: "Enable zpages debugging",
|
||||
EnvVars: []string{"IDP_DEBUG_ZPAGES"},
|
||||
Destination: &cfg.Debug.Zpages,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "http-addr",
|
||||
Value: flags.OverrideDefaultString(cfg.HTTP.Addr, "127.0.0.1:9130"),
|
||||
Usage: "Address to bind http server",
|
||||
EnvVars: []string{"IDP_HTTP_ADDR"},
|
||||
Destination: &cfg.HTTP.Addr,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "http-root",
|
||||
Value: flags.OverrideDefaultString(cfg.HTTP.Root, "/"),
|
||||
Usage: "Root path of http server",
|
||||
EnvVars: []string{"IDP_HTTP_ROOT"},
|
||||
Destination: &cfg.HTTP.Root,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "http-namespace",
|
||||
Value: flags.OverrideDefaultString(cfg.Service.Namespace, "com.owncloud.web"),
|
||||
Usage: "Set the base namespace for service discovery",
|
||||
EnvVars: []string{"IDP_HTTP_NAMESPACE"},
|
||||
Destination: &cfg.Service.Namespace,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "name",
|
||||
Value: flags.OverrideDefaultString(cfg.Service.Name, "idp"),
|
||||
Usage: "Service name",
|
||||
EnvVars: []string{"IDP_NAME"},
|
||||
Destination: &cfg.Service.Name,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "identity-manager",
|
||||
Value: flags.OverrideDefaultString(cfg.IDP.IdentityManager, "ldap"),
|
||||
Usage: "Identity manager (one of ldap,kc,cookie,dummy)",
|
||||
EnvVars: []string{"IDP_IDENTITY_MANAGER"},
|
||||
Destination: &cfg.IDP.IdentityManager,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "ldap-uri",
|
||||
Value: flags.OverrideDefaultString(cfg.Ldap.URI, "ldap://localhost:9125"),
|
||||
Usage: "URI of the LDAP server (glauth)",
|
||||
EnvVars: []string{"IDP_LDAP_URI"},
|
||||
Destination: &cfg.Ldap.URI,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "ldap-bind-dn",
|
||||
Value: flags.OverrideDefaultString(cfg.Ldap.BindDN, "cn=idp,ou=sysusers,dc=ocis,dc=test"),
|
||||
Usage: "Bind DN for the LDAP server (glauth)",
|
||||
EnvVars: []string{"IDP_LDAP_BIND_DN"},
|
||||
Destination: &cfg.Ldap.BindDN,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "ldap-bind-password",
|
||||
Value: flags.OverrideDefaultString(cfg.Ldap.BindPassword, "idp"),
|
||||
Usage: "Password for the Bind DN of the LDAP server (glauth)",
|
||||
EnvVars: []string{"IDP_LDAP_BIND_PASSWORD"},
|
||||
Destination: &cfg.Ldap.BindPassword,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "ldap-base-dn",
|
||||
Value: flags.OverrideDefaultString(cfg.Ldap.BaseDN, "ou=users,dc=ocis,dc=test"),
|
||||
Usage: "LDAP base DN of the oCIS users",
|
||||
EnvVars: []string{"IDP_LDAP_BASE_DN"},
|
||||
Destination: &cfg.Ldap.BaseDN,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "ldap-scope",
|
||||
Value: flags.OverrideDefaultString(cfg.Ldap.Scope, "sub"),
|
||||
Usage: "LDAP scope of the oCIS users",
|
||||
EnvVars: []string{"IDP_LDAP_SCOPE"},
|
||||
Destination: &cfg.Ldap.Scope,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "ldap-login-attribute",
|
||||
Value: flags.OverrideDefaultString(cfg.Ldap.LoginAttribute, "cn"),
|
||||
Usage: "LDAP login attribute of the oCIS users",
|
||||
EnvVars: []string{"IDP_LDAP_LOGIN_ATTRIBUTE"},
|
||||
Destination: &cfg.Ldap.LoginAttribute,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "ldap-email-attribute",
|
||||
Value: flags.OverrideDefaultString(cfg.Ldap.EmailAttribute, "mail"),
|
||||
Usage: "LDAP email attribute of the oCIS users",
|
||||
EnvVars: []string{"IDP_LDAP_EMAIL_ATTRIBUTE"},
|
||||
Destination: &cfg.Ldap.EmailAttribute,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "ldap-name-attribute",
|
||||
Value: flags.OverrideDefaultString(cfg.Ldap.NameAttribute, "sn"),
|
||||
Usage: "LDAP name attribute of the oCIS users",
|
||||
EnvVars: []string{"IDP_LDAP_NAME_ATTRIBUTE"},
|
||||
Destination: &cfg.Ldap.NameAttribute,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "ldap-uuid-attribute",
|
||||
Value: flags.OverrideDefaultString(cfg.Ldap.UUIDAttribute, "uid"),
|
||||
Usage: "LDAP UUID attribute of the oCIS users",
|
||||
EnvVars: []string{"IDP_LDAP_UUID_ATTRIBUTE"},
|
||||
Destination: &cfg.Ldap.UUIDAttribute,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "ldap-uuid-attribute-type",
|
||||
Value: flags.OverrideDefaultString(cfg.Ldap.UUIDAttributeType, "text"),
|
||||
Usage: "LDAP UUID attribute type of the oCIS users",
|
||||
EnvVars: []string{"IDP_LDAP_UUID_ATTRIBUTE_TYPE"},
|
||||
Destination: &cfg.Ldap.UUIDAttributeType,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "ldap-filter",
|
||||
Value: flags.OverrideDefaultString(cfg.Ldap.Filter, "(objectClass=posixaccount)"),
|
||||
Usage: "LDAP filter of the oCIS users",
|
||||
EnvVars: []string{"IDP_LDAP_FILTER"},
|
||||
Destination: &cfg.Ldap.Filter,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "transport-tls-cert",
|
||||
Value: flags.OverrideDefaultString(cfg.HTTP.TLSCert, path.Join(defaults.BaseDataPath(), "idp", "server.crt")),
|
||||
Usage: "Certificate file for transport encryption",
|
||||
EnvVars: []string{"IDP_TRANSPORT_TLS_CERT"},
|
||||
Destination: &cfg.HTTP.TLSCert,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "transport-tls-key",
|
||||
Value: flags.OverrideDefaultString(cfg.HTTP.TLSKey, path.Join(defaults.BaseDataPath(), "idp", "server.key")),
|
||||
Usage: "Secret file for transport encryption",
|
||||
EnvVars: []string{"IDP_TRANSPORT_TLS_KEY"},
|
||||
Destination: &cfg.HTTP.TLSKey,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "iss",
|
||||
Value: flags.OverrideDefaultString(cfg.IDP.Iss, "https://localhost:9200"),
|
||||
Usage: "OIDC issuer URL",
|
||||
EnvVars: []string{"IDP_ISS", "OCIS_URL"}, // IDP_ISS takes precedence over OCIS_URL
|
||||
Destination: &cfg.IDP.Iss,
|
||||
},
|
||||
&cli.StringSliceFlag{
|
||||
Name: "signing-private-key",
|
||||
Usage: "Full path to PEM encoded private key file (must match the --signing-method algorithm)",
|
||||
EnvVars: []string{"IDP_SIGNING_PRIVATE_KEY"},
|
||||
Value: nil,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "signing-kid",
|
||||
Usage: "Value of kid field to use in created tokens (uniquely identifying the signing-private-key)",
|
||||
EnvVars: []string{"IDP_SIGNING_KID"},
|
||||
Value: flags.OverrideDefaultString(cfg.IDP.SigningKid, ""),
|
||||
Destination: &cfg.IDP.SigningKid,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "validation-keys-path",
|
||||
Usage: "Full path to a folder containing PEM encoded private or public key files used for token validation (file name without extension is used as kid)",
|
||||
EnvVars: []string{"IDP_VALIDATION_KEYS_PATH"},
|
||||
Value: flags.OverrideDefaultString(cfg.IDP.ValidationKeysPath, ""),
|
||||
Destination: &cfg.IDP.ValidationKeysPath,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "encryption-secret",
|
||||
Usage: "Full path to a file containing a %d bytes secret key",
|
||||
EnvVars: []string{"IDP_ENCRYPTION_SECRET"},
|
||||
Value: flags.OverrideDefaultString(cfg.IDP.EncryptionSecretFile, ""),
|
||||
Destination: &cfg.IDP.EncryptionSecretFile,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "signing-method",
|
||||
Usage: "JWT default signing method",
|
||||
EnvVars: []string{"IDP_SIGNING_METHOD"},
|
||||
Value: flags.OverrideDefaultString(cfg.IDP.SigningMethod, "PS256"),
|
||||
Destination: &cfg.IDP.SigningMethod,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "uri-base-path",
|
||||
Usage: "Custom base path for URI endpoints",
|
||||
EnvVars: []string{"IDP_URI_BASE_PATH"},
|
||||
Value: flags.OverrideDefaultString(cfg.IDP.URIBasePath, ""),
|
||||
Destination: &cfg.IDP.URIBasePath,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "sign-in-uri",
|
||||
Usage: "Custom redirection URI to sign-in form",
|
||||
EnvVars: []string{"IDP_SIGN_IN_URI"},
|
||||
Value: flags.OverrideDefaultString(cfg.IDP.SignInURI, ""),
|
||||
Destination: &cfg.IDP.SignInURI,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "signed-out-uri",
|
||||
Usage: "Custom redirection URI to signed-out goodbye page",
|
||||
EnvVars: []string{"IDP_SIGN_OUT_URI"},
|
||||
Value: flags.OverrideDefaultString(cfg.IDP.SignedOutURI, ""),
|
||||
Destination: &cfg.IDP.SignedOutURI,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "authorization-endpoint-uri",
|
||||
Usage: "Custom authorization endpoint URI",
|
||||
EnvVars: []string{"IDP_ENDPOINT_URI"},
|
||||
Value: flags.OverrideDefaultString(cfg.IDP.AuthorizationEndpointURI, ""),
|
||||
Destination: &cfg.IDP.AuthorizationEndpointURI,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "endsession-endpoint-uri",
|
||||
Usage: "Custom endsession endpoint URI",
|
||||
EnvVars: []string{"IDP_ENDSESSION_ENDPOINT_URI"},
|
||||
Value: flags.OverrideDefaultString(cfg.IDP.EndsessionEndpointURI, ""),
|
||||
Destination: &cfg.IDP.EndsessionEndpointURI,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "asset-path",
|
||||
Value: flags.OverrideDefaultString(cfg.Asset.Path, ""),
|
||||
Usage: "Path to custom assets",
|
||||
EnvVars: []string{"IDP_ASSET_PATH"},
|
||||
Destination: &cfg.Asset.Path,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "identifier-client-path",
|
||||
Usage: "Path to the identifier web client base folder",
|
||||
EnvVars: []string{"IDP_IDENTIFIER_CLIENT_PATH"},
|
||||
Value: flags.OverrideDefaultString(cfg.IDP.IdentifierClientPath, path.Join(defaults.BaseDataPath(), "idp")),
|
||||
Destination: &cfg.IDP.IdentifierClientPath,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "identifier-registration-conf",
|
||||
Usage: "Path to a identifier-registration.yaml configuration file",
|
||||
EnvVars: []string{"IDP_IDENTIFIER_REGISTRATION_CONF"},
|
||||
Value: flags.OverrideDefaultString(cfg.IDP.IdentifierRegistrationConf, path.Join(defaults.BaseDataPath(), "idp", "identifier-registration.yaml")),
|
||||
Destination: &cfg.IDP.IdentifierRegistrationConf,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "identifier-scopes-conf",
|
||||
Usage: "Path to a scopes.yaml configuration file",
|
||||
EnvVars: []string{"IDP_IDENTIFIER_SCOPES_CONF"},
|
||||
Value: flags.OverrideDefaultString(cfg.IDP.IdentifierScopesConf, ""),
|
||||
Destination: &cfg.IDP.IdentifierScopesConf,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "insecure",
|
||||
Usage: "Disable TLS certificate and hostname validation",
|
||||
Value: flags.OverrideDefaultBool(cfg.IDP.Insecure, false),
|
||||
EnvVars: []string{"IDP_INSECURE"},
|
||||
Destination: &cfg.IDP.Insecure,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "tls",
|
||||
Usage: "Use TLS (disable only if idp is behind a TLS-terminating reverse-proxy).",
|
||||
EnvVars: []string{"IDP_TLS"},
|
||||
Value: flags.OverrideDefaultBool(cfg.HTTP.TLS, false),
|
||||
Destination: &cfg.HTTP.TLS,
|
||||
},
|
||||
&cli.StringSliceFlag{
|
||||
Name: "trusted-proxy",
|
||||
Usage: "Trusted proxy IP or IP network (can be used multiple times)",
|
||||
EnvVars: []string{"IDP_TRUSTED_PROXY"},
|
||||
Value: nil,
|
||||
},
|
||||
&cli.StringSliceFlag{
|
||||
Name: "allow-scope",
|
||||
Usage: "Allow OAuth 2 scope (can be used multiple times, if not set default scopes are allowed)",
|
||||
EnvVars: []string{"IDP_ALLOW_SCOPE"},
|
||||
Value: nil,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "allow-client-guests",
|
||||
Usage: "Allow sign in of client controlled guest users",
|
||||
EnvVars: []string{"IDP_ALLOW_CLIENT_GUESTS"},
|
||||
Destination: &cfg.IDP.AllowClientGuests,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "allow-dynamic-client-registration",
|
||||
Usage: "Allow dynamic OAuth2 client registration",
|
||||
EnvVars: []string{"IDP_ALLOW_DYNAMIC_CLIENT_REGISTRATION"},
|
||||
Value: flags.OverrideDefaultBool(cfg.IDP.AllowDynamicClientRegistration, false),
|
||||
Destination: &cfg.IDP.AllowDynamicClientRegistration,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "disable-identifier-webapp",
|
||||
Usage: "Disable built-in identifier-webapp to use a frontend hosted elsewhere.",
|
||||
EnvVars: []string{"IDP_DISABLE_IDENTIFIER_WEBAPP"},
|
||||
Value: flags.OverrideDefaultBool(cfg.IDP.IdentifierClientDisabled, true),
|
||||
Destination: &cfg.IDP.IdentifierClientDisabled,
|
||||
},
|
||||
&cli.Uint64Flag{
|
||||
Name: "access-token-expiration",
|
||||
Usage: "Expiration time of access tokens in seconds since generated",
|
||||
EnvVars: []string{"IDP_ACCESS_TOKEN_EXPIRATION"},
|
||||
Destination: &cfg.IDP.AccessTokenDurationSeconds,
|
||||
Value: flags.OverrideDefaultUint64(cfg.IDP.AccessTokenDurationSeconds, 60*10), // 10 minutes
|
||||
},
|
||||
&cli.Uint64Flag{
|
||||
Name: "id-token-expiration",
|
||||
Usage: "Expiration time of id tokens in seconds since generated",
|
||||
EnvVars: []string{"IDP_ID_TOKEN_EXPIRATION"},
|
||||
Destination: &cfg.IDP.IDTokenDurationSeconds,
|
||||
Value: flags.OverrideDefaultUint64(cfg.IDP.IDTokenDurationSeconds, 60*60), // 1 hour
|
||||
},
|
||||
&cli.Uint64Flag{
|
||||
Name: "refresh-token-expiration",
|
||||
Usage: "Expiration time of refresh tokens in seconds since generated",
|
||||
EnvVars: []string{"IDP_REFRESH_TOKEN_EXPIRATION"},
|
||||
Destination: &cfg.IDP.RefreshTokenDurationSeconds,
|
||||
Value: flags.OverrideDefaultUint64(cfg.IDP.RefreshTokenDurationSeconds, 60*60*24*365*3), // 1 year
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "extensions",
|
||||
Usage: "Run specific extensions during supervised mode. This flag is set by the runtime",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// ListIDPWithConfig applies the config to the list commands flags
|
||||
func ListIDPWithConfig(cfg *config.Config) []cli.Flag {
|
||||
return []cli.Flag{&cli.StringFlag{
|
||||
Name: "http-namespace",
|
||||
Value: flags.OverrideDefaultString(cfg.Service.Namespace, "com.owncloud.web"),
|
||||
Usage: "Set the base namespace for service discovery",
|
||||
EnvVars: []string{"IDP_HTTP_NAMESPACE"},
|
||||
Destination: &cfg.Service.Namespace,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "name",
|
||||
Value: flags.OverrideDefaultString(cfg.Service.Name, "idp"),
|
||||
Usage: "Service name",
|
||||
EnvVars: []string{"IDP_NAME"},
|
||||
Destination: &cfg.Service.Name,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -55,7 +55,10 @@ func NewService(opts ...Option) Service {
|
||||
dummyBackendSupport.MustRegister()
|
||||
kcBackendSupport.MustRegister()
|
||||
|
||||
bs, err := bootstrap.Boot(ctx, &options.Config.IDP, &licoconfig.Config{
|
||||
// https://play.golang.org/p/Mh8AVJCd593
|
||||
idpSettings := bootstrap.Settings(options.Config.IDP)
|
||||
|
||||
bs, err := bootstrap.Boot(ctx, &idpSettings, &licoconfig.Config{
|
||||
Logger: logw.Wrap(logger),
|
||||
})
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"github.com/owncloud/ocis/ocis-pkg/shared"
|
||||
|
||||
accounts "github.com/owncloud/ocis/accounts/pkg/config"
|
||||
glauth "github.com/owncloud/ocis/glauth/pkg/config"
|
||||
graphExplorer "github.com/owncloud/ocis/graph-explorer/pkg/config"
|
||||
@@ -16,45 +18,37 @@ import (
|
||||
webdav "github.com/owncloud/ocis/webdav/pkg/config"
|
||||
)
|
||||
|
||||
// Log defines the available logging configuration.
|
||||
type Log struct {
|
||||
Level string
|
||||
Pretty bool
|
||||
Color bool
|
||||
File string
|
||||
}
|
||||
|
||||
// Debug defines the available debug configuration.
|
||||
type Debug struct {
|
||||
Addr string
|
||||
Token string
|
||||
Pprof bool
|
||||
Zpages bool
|
||||
Addr string `ocisConfig:"addr"`
|
||||
Token string `ocisConfig:"token"`
|
||||
Pprof bool `ocisConfig:"pprof"`
|
||||
Zpages bool `ocisConfig:"zpages"`
|
||||
}
|
||||
|
||||
// HTTP defines the available http configuration.
|
||||
type HTTP struct {
|
||||
Addr string
|
||||
Root string
|
||||
Addr string `ocisConfig:"addr"`
|
||||
Root string `ocisConfig:"root"`
|
||||
}
|
||||
|
||||
// GRPC defines the available grpc configuration.
|
||||
type GRPC struct {
|
||||
Addr string
|
||||
Addr string `ocisConfig:"addr"`
|
||||
}
|
||||
|
||||
// Tracing defines the available tracing configuration.
|
||||
type Tracing struct {
|
||||
Enabled bool
|
||||
Type string
|
||||
Endpoint string
|
||||
Collector string
|
||||
Service string
|
||||
Enabled bool `ocisConfig:"enabled"`
|
||||
Type string `ocisConfig:"type"`
|
||||
Endpoint string `ocisConfig:"endpoint"`
|
||||
Collector string `ocisConfig:"collector"`
|
||||
Service string `ocisConfig:"service"`
|
||||
}
|
||||
|
||||
// TokenManager is the config for using the reva token manager
|
||||
type TokenManager struct {
|
||||
JWTSecret string
|
||||
JWTSecret string `ocisConfig:"jwt_secret"`
|
||||
}
|
||||
|
||||
const (
|
||||
@@ -69,58 +63,206 @@ type Mode int
|
||||
|
||||
// Runtime configures the oCIS runtime when running in supervised mode.
|
||||
type Runtime struct {
|
||||
Port string
|
||||
Host string
|
||||
Extensions string
|
||||
Port string `ocisConfig:"port"`
|
||||
Host string `ocisConfig:"host"`
|
||||
Extensions string `ocisConfig:"extensions"`
|
||||
}
|
||||
|
||||
// Config combines all available configuration parts.
|
||||
type Config struct {
|
||||
// Mode is mostly used whenever we need to run an extension. The technical debt this introduces is in regards of
|
||||
// what it does. Supervised (0) loads configuration from a unified config file because of known limitations of Viper; whereas
|
||||
// Unsupervised (1) MUST parse config from all known sources.
|
||||
Mode Mode
|
||||
File string
|
||||
*shared.Commons `ocisConfig:"shared"`
|
||||
|
||||
Registry string
|
||||
Log Log
|
||||
Debug Debug
|
||||
HTTP HTTP
|
||||
GRPC GRPC
|
||||
Tracing Tracing
|
||||
TokenManager TokenManager
|
||||
Runtime Runtime
|
||||
Mode Mode // DEPRECATED
|
||||
File string
|
||||
OcisURL string `ocisConfig:"ocis_url"`
|
||||
|
||||
Accounts *accounts.Config
|
||||
GLAuth *glauth.Config
|
||||
Graph *graph.Config
|
||||
GraphExplorer *graphExplorer.Config
|
||||
IDP *idp.Config
|
||||
OCS *ocs.Config
|
||||
Web *web.Config
|
||||
Proxy *proxy.Config
|
||||
Settings *settings.Config
|
||||
Storage *storage.Config
|
||||
Store *store.Config
|
||||
Thumbnails *thumbnails.Config
|
||||
WebDAV *webdav.Config
|
||||
Registry string `ocisConfig:"registry"`
|
||||
Log shared.Log `ocisConfig:"log"`
|
||||
Debug Debug `ocisConfig:"debug"`
|
||||
HTTP HTTP `ocisConfig:"http"`
|
||||
GRPC GRPC `ocisConfig:"grpc"`
|
||||
Tracing Tracing `ocisConfig:"tracing"`
|
||||
TokenManager TokenManager `ocisConfig:"token_manager"`
|
||||
Runtime Runtime `ocisConfig:"runtime"`
|
||||
|
||||
Accounts *accounts.Config `ocisConfig:"accounts"`
|
||||
GLAuth *glauth.Config `ocisConfig:"glauth"`
|
||||
Graph *graph.Config `ocisConfig:"graph"`
|
||||
GraphExplorer *graphExplorer.Config `ocisConfig:"graph_explorer"`
|
||||
IDP *idp.Config `ocisConfig:"idp"`
|
||||
OCS *ocs.Config `ocisConfig:"ocs"`
|
||||
Web *web.Config `ocisConfig:"web"`
|
||||
Proxy *proxy.Config `ocisConfig:"proxy"`
|
||||
Settings *settings.Config `ocisConfig:"settings"`
|
||||
Storage *storage.Config `ocisConfig:"storage"`
|
||||
Store *store.Config `ocisConfig:"store"`
|
||||
Thumbnails *thumbnails.Config `ocisConfig:"thumbnails"`
|
||||
WebDAV *webdav.Config `ocisConfig:"webdav"`
|
||||
}
|
||||
|
||||
// New initializes a new configuration with or without defaults.
|
||||
func New() *Config {
|
||||
return &Config{
|
||||
Accounts: accounts.New(),
|
||||
GLAuth: glauth.New(),
|
||||
Graph: graph.New(),
|
||||
GraphExplorer: graphExplorer.New(),
|
||||
IDP: idp.New(),
|
||||
OCS: ocs.New(),
|
||||
Web: web.New(),
|
||||
Proxy: proxy.New(),
|
||||
Settings: settings.New(),
|
||||
Storage: storage.New(),
|
||||
Store: store.New(),
|
||||
Thumbnails: thumbnails.New(),
|
||||
WebDAV: webdav.New(),
|
||||
Accounts: accounts.DefaultConfig(),
|
||||
GLAuth: glauth.DefaultConfig(),
|
||||
Graph: graph.DefaultConfig(),
|
||||
IDP: idp.DefaultConfig(),
|
||||
Proxy: proxy.DefaultConfig(),
|
||||
GraphExplorer: graphExplorer.DefaultConfig(),
|
||||
OCS: ocs.DefaultConfig(),
|
||||
Settings: settings.DefaultConfig(),
|
||||
Web: web.DefaultConfig(),
|
||||
Store: store.DefaultConfig(),
|
||||
Thumbnails: thumbnails.DefaultConfig(),
|
||||
WebDAV: webdav.DefaultConfig(),
|
||||
Storage: storage.DefaultConfig(),
|
||||
}
|
||||
}
|
||||
|
||||
func DefaultConfig() *Config {
|
||||
return &Config{
|
||||
Debug: Debug{
|
||||
Addr: "127.0.0.1:9010",
|
||||
Token: "",
|
||||
Pprof: false,
|
||||
Zpages: false,
|
||||
},
|
||||
HTTP: HTTP{
|
||||
Addr: "127.0.0.1:9000",
|
||||
Root: "/",
|
||||
},
|
||||
GRPC: GRPC{
|
||||
Addr: "127.0.0.1:9001",
|
||||
},
|
||||
Tracing: Tracing{
|
||||
Enabled: false,
|
||||
Type: "jaeger",
|
||||
Endpoint: "",
|
||||
Collector: "",
|
||||
Service: "ocis",
|
||||
},
|
||||
TokenManager: TokenManager{
|
||||
JWTSecret: "Pive-Fumkiu4",
|
||||
},
|
||||
Runtime: Runtime{
|
||||
Port: "9250",
|
||||
Host: "localhost",
|
||||
},
|
||||
Accounts: accounts.DefaultConfig(),
|
||||
GLAuth: glauth.DefaultConfig(),
|
||||
Graph: graph.DefaultConfig(),
|
||||
IDP: idp.DefaultConfig(),
|
||||
Proxy: proxy.DefaultConfig(),
|
||||
GraphExplorer: graphExplorer.DefaultConfig(),
|
||||
OCS: ocs.DefaultConfig(),
|
||||
Settings: settings.DefaultConfig(),
|
||||
Web: web.DefaultConfig(),
|
||||
Store: store.DefaultConfig(),
|
||||
Thumbnails: thumbnails.DefaultConfig(),
|
||||
WebDAV: webdav.DefaultConfig(),
|
||||
Storage: storage.DefaultConfig(),
|
||||
}
|
||||
}
|
||||
|
||||
// GetEnv fetches a list of known env variables for this extension. It is to be used by gookit, as it provides a list
|
||||
// with all the environment variables an extension supports.
|
||||
func GetEnv() []string {
|
||||
var r = make([]string, len(structMappings(&Config{})))
|
||||
for i := range structMappings(&Config{}) {
|
||||
r = append(r, structMappings(&Config{})[i].EnvVars...)
|
||||
}
|
||||
|
||||
return r
|
||||
}
|
||||
|
||||
// StructMappings binds a set of environment variables to a destination on cfg. Iterating over this set and editing the
|
||||
// Destination value of a binding will alter the original value, as it is a pointer to its memory address. This lets
|
||||
// us propagate changes easier.
|
||||
func StructMappings(cfg *Config) []shared.EnvBinding {
|
||||
return structMappings(cfg)
|
||||
}
|
||||
|
||||
func structMappings(cfg *Config) []shared.EnvBinding {
|
||||
return []shared.EnvBinding{
|
||||
{
|
||||
EnvVars: []string{"OCIS_LOG_LEVEL"},
|
||||
Destination: &cfg.Log.Level,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_LOG_COLOR"},
|
||||
Destination: &cfg.Log.Color,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_LOG_PRETTY"},
|
||||
Destination: &cfg.Log.Pretty,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_LOG_FILE"},
|
||||
Destination: &cfg.Log.File,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_TRACING_ENABLED"},
|
||||
Destination: &cfg.Tracing.Enabled,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_TRACING_TYPE"},
|
||||
Destination: &cfg.Tracing.Type,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_TRACING_ENDPOINT"},
|
||||
Destination: &cfg.Tracing.Endpoint,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_TRACING_COLLECTOR"},
|
||||
Destination: &cfg.Tracing.Collector,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_TRACING_SERVICE"},
|
||||
Destination: &cfg.Tracing.Service,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_JWT_SECRET"},
|
||||
Destination: &cfg.TokenManager.JWTSecret,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_RUNTIME_PORT"},
|
||||
Destination: &cfg.Runtime.Port,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_RUNTIME_HOST"},
|
||||
Destination: &cfg.Runtime.Host,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_DEBUG_ADDR"},
|
||||
Destination: &cfg.Debug.Addr,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_DEBUG_TOKEN"},
|
||||
Destination: &cfg.Debug.Token,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_DEBUG_PPROF"},
|
||||
Destination: &cfg.Debug.Pprof,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_DEBUG_ZPAGES"},
|
||||
Destination: &cfg.Debug.Zpages,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_HTTP_ADDR"},
|
||||
Destination: &cfg.HTTP.Addr,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_HTTP_ROOT"},
|
||||
Destination: &cfg.HTTP.Root,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_GRPC_ADDR"},
|
||||
Destination: &cfg.GRPC.Addr,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_RUN_EXTENSIONS"},
|
||||
Destination: &cfg.Runtime.Extensions,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
17
ocis-pkg/config/config_test.go
Normal file
17
ocis-pkg/config/config_test.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
func TestDefaultConfig(t *testing.T) {
|
||||
cfg := DefaultConfig()
|
||||
yBytes, err := yaml.Marshal(cfg)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
fmt.Println(string(yBytes))
|
||||
}
|
||||
47
ocis-pkg/config/environment.go
Normal file
47
ocis-pkg/config/environment.go
Normal file
@@ -0,0 +1,47 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
|
||||
gofig "github.com/gookit/config/v2"
|
||||
"github.com/owncloud/ocis/ocis-pkg/shared"
|
||||
)
|
||||
|
||||
// BindEnv takes a config `c` and a EnvBinding and binds the values from the environment to the address location in cfg.
|
||||
func BindEnv(c *gofig.Config, bindings []shared.EnvBinding) error {
|
||||
return bindEnv(c, bindings)
|
||||
}
|
||||
|
||||
func bindEnv(c *gofig.Config, bindings []shared.EnvBinding) error {
|
||||
for i := range bindings {
|
||||
for j := range bindings[i].EnvVars {
|
||||
// we need to guard against v != "" because this is the condition that checks that the value is set from the environment.
|
||||
// the `ok` guard is not enough, apparently.
|
||||
if v, ok := c.GetValue(bindings[i].EnvVars[j]); ok && v != "" {
|
||||
|
||||
// get the destination type from destination
|
||||
switch reflect.ValueOf(bindings[i].Destination).Type().String() {
|
||||
case "*bool":
|
||||
r := c.Bool(bindings[i].EnvVars[j])
|
||||
*bindings[i].Destination.(*bool) = r
|
||||
case "*string":
|
||||
r := c.String(bindings[i].EnvVars[j])
|
||||
*bindings[i].Destination.(*string) = r
|
||||
case "*int":
|
||||
r := c.Int(bindings[i].EnvVars[j])
|
||||
*bindings[i].Destination.(*int) = r
|
||||
case "*float64":
|
||||
// defaults to float64
|
||||
r := c.Float(bindings[i].EnvVars[j])
|
||||
*bindings[i].Destination.(*float64) = r
|
||||
default:
|
||||
// it is unlikely we will ever get here. Let this serve more as a runtime check for when debugging.
|
||||
return fmt.Errorf("invalid type for env var: `%v`", bindings[i].EnvVars[j])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
85
ocis-pkg/config/helpers.go
Normal file
85
ocis-pkg/config/helpers.go
Normal file
@@ -0,0 +1,85 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"io/fs"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
gofig "github.com/gookit/config/v2"
|
||||
goojson "github.com/gookit/config/v2/json"
|
||||
gooyaml "github.com/gookit/config/v2/yaml"
|
||||
)
|
||||
|
||||
var (
|
||||
defaultLocations = []string{
|
||||
filepath.Join(os.Getenv("HOME"), "/.ocis/config/"),
|
||||
"/etc/ocis/",
|
||||
".config/",
|
||||
}
|
||||
|
||||
// supportedExtensions is determined by gookit/config.
|
||||
supportedExtensions = []string{
|
||||
"yaml",
|
||||
"yml",
|
||||
"json",
|
||||
}
|
||||
)
|
||||
|
||||
// DefaultConfigSources returns a slice with matched expected config files. It sugars coat several aspects of config file
|
||||
// management by assuming there are 3 default locations a config file could be.
|
||||
// It uses globbing to match a config file by name, and retrieve any supported extension supported by our drivers.
|
||||
// It sanitizes the output depending on the list of drivers provided.
|
||||
func DefaultConfigSources(filename string, drivers []string) []string {
|
||||
var sources []string
|
||||
|
||||
for i := range defaultLocations {
|
||||
dirFS := os.DirFS(defaultLocations[i])
|
||||
pattern := filename + ".*"
|
||||
matched, _ := fs.Glob(dirFS, pattern)
|
||||
if len(matched) > 0 {
|
||||
// prepend path to results
|
||||
for j := 0; j < len(matched); j++ {
|
||||
matched[j] = filepath.Join(defaultLocations[i], matched[j])
|
||||
}
|
||||
}
|
||||
sources = append(sources, matched...)
|
||||
}
|
||||
|
||||
return sanitizeExtensions(sources, drivers, func(a, b string) bool {
|
||||
return strings.HasSuffix(filepath.Base(a), b)
|
||||
})
|
||||
}
|
||||
|
||||
// sanitizeExtensions removes elements from "set" which extensions are not in "ext".
|
||||
func sanitizeExtensions(set []string, ext []string, f func(a, b string) bool) []string {
|
||||
var r []string
|
||||
for i := 0; i < len(set); i++ {
|
||||
for j := 0; j < len(ext); j++ {
|
||||
if f(filepath.Base(set[i]), ext[j]) {
|
||||
r = append(r, set[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
// BindSourcesToStructs assigns any config value from a config file / env variable to struct `dst`. Its only purpose
|
||||
// is to solely modify `dst`, not dealing with the config structs; and do so in a thread safe manner.
|
||||
func BindSourcesToStructs(extension string, dst interface{}) (*gofig.Config, error) {
|
||||
sources := DefaultConfigSources(extension, supportedExtensions)
|
||||
cnf := gofig.NewWithOptions(extension, gofig.ParseEnv)
|
||||
cnf.WithOptions(func(options *gofig.Options) {
|
||||
options.DecoderConfig.TagName = "ocisConfig"
|
||||
})
|
||||
cnf.AddDriver(gooyaml.Driver)
|
||||
cnf.AddDriver(goojson.Driver)
|
||||
_ = cnf.LoadFiles(sources...)
|
||||
|
||||
err := cnf.BindStruct("", &dst)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return cnf, nil
|
||||
}
|
||||
@@ -6,6 +6,8 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/shared"
|
||||
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/rs/zerolog/log"
|
||||
mdlog "go-micro.dev/v4/debug/log"
|
||||
@@ -18,6 +20,17 @@ type Logger struct {
|
||||
zerolog.Logger
|
||||
}
|
||||
|
||||
// LoggerFromConfig initializes a service-specific logger instance.
|
||||
func LoggerFromConfig(name string, cfg shared.Log) Logger {
|
||||
return NewLogger(
|
||||
Name(name),
|
||||
Level(cfg.Level),
|
||||
Pretty(cfg.Pretty),
|
||||
Color(cfg.Color),
|
||||
File(cfg.File),
|
||||
)
|
||||
}
|
||||
|
||||
// NewLogger initializes a new logger instance.
|
||||
func NewLogger(opts ...Option) Logger {
|
||||
options := newOptions(opts...)
|
||||
|
||||
@@ -20,6 +20,7 @@ type Options struct {
|
||||
Zpages bool
|
||||
Health func(http.ResponseWriter, *http.Request)
|
||||
Ready func(http.ResponseWriter, *http.Request)
|
||||
ConfigDump func(http.ResponseWriter, *http.Request)
|
||||
CorsAllowedOrigins []string
|
||||
CorsAllowedMethods []string
|
||||
CorsAllowedHeaders []string
|
||||
@@ -100,6 +101,13 @@ func Ready(r func(http.ResponseWriter, *http.Request)) Option {
|
||||
}
|
||||
}
|
||||
|
||||
// ConfigDump to be documented.
|
||||
func ConfigDump(r func(http.ResponseWriter, *http.Request)) Option {
|
||||
return func(o *Options) {
|
||||
o.ConfigDump = r
|
||||
}
|
||||
}
|
||||
|
||||
// CorsAllowedOrigins provides a function to set the CorsAllowedOrigin option.
|
||||
func CorsAllowedOrigins(origins []string) Option {
|
||||
return func(o *Options) {
|
||||
|
||||
@@ -15,12 +15,6 @@ import (
|
||||
// NewService initializes a new debug service.
|
||||
func NewService(opts ...Option) *http.Server {
|
||||
dopts := newOptions(opts...)
|
||||
|
||||
dopts.Logger.Info().
|
||||
Str("transport", "debug").
|
||||
Str("addr", dopts.Address).
|
||||
Msg("starting server")
|
||||
|
||||
mux := http.NewServeMux()
|
||||
|
||||
mux.Handle("/metrics", alice.New(
|
||||
@@ -34,6 +28,10 @@ func NewService(opts ...Option) *http.Server {
|
||||
mux.HandleFunc("/healthz", dopts.Health)
|
||||
mux.HandleFunc("/readyz", dopts.Ready)
|
||||
|
||||
if dopts.ConfigDump != nil {
|
||||
mux.HandleFunc("/config", dopts.ConfigDump)
|
||||
}
|
||||
|
||||
if dopts.Pprof {
|
||||
mux.HandleFunc("/debug/pprof/", pprof.Index)
|
||||
mux.HandleFunc("/debug/pprof/cmdline", pprof.Cmdline)
|
||||
|
||||
@@ -32,11 +32,6 @@ type Service struct {
|
||||
func NewService(opts ...Option) Service {
|
||||
sopts := newOptions(opts...)
|
||||
|
||||
sopts.Logger.Info().
|
||||
Str("transport", "grpc").
|
||||
Str("addr", sopts.Address).
|
||||
Msg("starting server")
|
||||
|
||||
mopts := []micro.Option{
|
||||
// first add a server because it will reset any options
|
||||
micro.Server(mgrpcs.NewServer()),
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package http
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -20,11 +19,6 @@ type Service struct {
|
||||
// NewService initializes a new http service.
|
||||
func NewService(opts ...Option) Service {
|
||||
sopts := newOptions(opts...)
|
||||
sopts.Logger.Info().
|
||||
Str("transport", transport(sopts.TLSConfig)).
|
||||
Str("addr", sopts.Address).
|
||||
Msg("starting server")
|
||||
|
||||
wopts := []micro.Option{
|
||||
micro.Server(mhttps.NewServer(server.TLSConfig(sopts.TLSConfig))),
|
||||
micro.Address(sopts.Address),
|
||||
@@ -39,11 +33,3 @@ func NewService(opts ...Option) Service {
|
||||
|
||||
return Service{micro.NewService(wopts...)}
|
||||
}
|
||||
|
||||
func transport(secure *tls.Config) string {
|
||||
if secure != nil {
|
||||
return "https"
|
||||
}
|
||||
|
||||
return "http"
|
||||
}
|
||||
|
||||
24
ocis-pkg/shared/shared_types.go
Normal file
24
ocis-pkg/shared/shared_types.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package shared
|
||||
|
||||
// EnvBinding represents a direct binding from an env variable to a go kind. Along with gookit/config, its primal goal
|
||||
// is to unpack environment variables into a Go value. We do so with reflection, and this data structure is just a step
|
||||
// in between.
|
||||
type EnvBinding struct {
|
||||
EnvVars []string // name of the environment var.
|
||||
Destination interface{} // pointer to the original config value to modify.
|
||||
}
|
||||
|
||||
// Log defines the available logging configuration.
|
||||
type Log struct {
|
||||
Level string `mapstructure:"level"`
|
||||
Pretty bool `mapstructure:"pretty"`
|
||||
Color bool `mapstructure:"color"`
|
||||
File string `mapstructure:"file"`
|
||||
}
|
||||
|
||||
// Commons holds configuration that are common to all extensions. Each extension can then decide whether
|
||||
// to overwrite its values.
|
||||
type Commons struct {
|
||||
*Log `mapstructure:"log"`
|
||||
OcisURL string `mapstructure:"ocis_url"`
|
||||
}
|
||||
@@ -5,10 +5,7 @@ package command
|
||||
|
||||
import (
|
||||
"github.com/owncloud/ocis/accounts/pkg/command"
|
||||
svcconfig "github.com/owncloud/ocis/accounts/pkg/config"
|
||||
"github.com/owncloud/ocis/accounts/pkg/flagset"
|
||||
"github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/version"
|
||||
"github.com/owncloud/ocis/ocis/pkg/register"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
@@ -19,7 +16,6 @@ func AccountsCommand(cfg *config.Config) *cli.Command {
|
||||
Name: "accounts",
|
||||
Usage: "Start accounts server",
|
||||
Category: "Extensions",
|
||||
Flags: flagset.ServerWithConfig(cfg.Accounts),
|
||||
Subcommands: []*cli.Command{
|
||||
command.ListAccounts(cfg.Accounts),
|
||||
command.AddAccount(cfg.Accounts),
|
||||
@@ -29,36 +25,23 @@ func AccountsCommand(cfg *config.Config) *cli.Command {
|
||||
command.PrintVersion(cfg.Accounts),
|
||||
},
|
||||
Before: func(ctx *cli.Context) error {
|
||||
return ParseConfig(ctx, cfg)
|
||||
if err := ParseConfig(ctx, cfg); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if cfg.Commons != nil {
|
||||
cfg.Accounts.Commons = cfg.Commons
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
origCmd := command.Server(configureAccounts(cfg))
|
||||
origCmd := command.Server(cfg.Accounts)
|
||||
return handleOriginalAction(c, origCmd)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func configureAccounts(cfg *config.Config) *svcconfig.Config {
|
||||
cfg.Accounts.Log.Level = cfg.Log.Level
|
||||
cfg.Accounts.Log.Pretty = cfg.Log.Pretty
|
||||
cfg.Accounts.Log.Color = cfg.Log.Color
|
||||
cfg.Accounts.Server.Version = version.String
|
||||
|
||||
if cfg.Tracing.Enabled {
|
||||
cfg.Accounts.Tracing.Enabled = cfg.Tracing.Enabled
|
||||
cfg.Accounts.Tracing.Type = cfg.Tracing.Type
|
||||
cfg.Accounts.Tracing.Endpoint = cfg.Tracing.Endpoint
|
||||
cfg.Accounts.Tracing.Collector = cfg.Tracing.Collector
|
||||
}
|
||||
|
||||
if cfg.TokenManager.JWTSecret != "" {
|
||||
cfg.Accounts.TokenManager.JWTSecret = cfg.TokenManager.JWTSecret
|
||||
cfg.Accounts.Repo.CS3.JWTSecret = cfg.TokenManager.JWTSecret
|
||||
}
|
||||
|
||||
return cfg.Accounts
|
||||
}
|
||||
|
||||
func init() {
|
||||
register.AddCommand(AccountsCommand)
|
||||
}
|
||||
|
||||
@@ -2,10 +2,7 @@ package command
|
||||
|
||||
import (
|
||||
"github.com/owncloud/ocis/glauth/pkg/command"
|
||||
svcconfig "github.com/owncloud/ocis/glauth/pkg/config"
|
||||
"github.com/owncloud/ocis/glauth/pkg/flagset"
|
||||
"github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/version"
|
||||
"github.com/owncloud/ocis/ocis/pkg/register"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
@@ -16,33 +13,24 @@ func GLAuthCommand(cfg *config.Config) *cli.Command {
|
||||
Name: "glauth",
|
||||
Usage: "Start glauth server",
|
||||
Category: "Extensions",
|
||||
Flags: flagset.ServerWithConfig(cfg.GLAuth),
|
||||
Before: func(ctx *cli.Context) error {
|
||||
return ParseConfig(ctx, cfg)
|
||||
if err := ParseConfig(ctx, cfg); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if cfg.Commons != nil {
|
||||
cfg.GLAuth.Commons = cfg.Commons
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
origCmd := command.Server(configureGLAuth(cfg))
|
||||
origCmd := command.Server(cfg.GLAuth)
|
||||
return handleOriginalAction(c, origCmd)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func configureGLAuth(cfg *config.Config) *svcconfig.Config {
|
||||
cfg.GLAuth.Log.Level = cfg.Log.Level
|
||||
cfg.GLAuth.Log.Pretty = cfg.Log.Pretty
|
||||
cfg.GLAuth.Log.Color = cfg.Log.Color
|
||||
cfg.GLAuth.Version = version.String
|
||||
|
||||
if cfg.Tracing.Enabled {
|
||||
cfg.GLAuth.Tracing.Enabled = cfg.Tracing.Enabled
|
||||
cfg.GLAuth.Tracing.Type = cfg.Tracing.Type
|
||||
cfg.GLAuth.Tracing.Endpoint = cfg.Tracing.Endpoint
|
||||
cfg.GLAuth.Tracing.Collector = cfg.Tracing.Collector
|
||||
}
|
||||
|
||||
return cfg.GLAuth
|
||||
}
|
||||
|
||||
func init() {
|
||||
register.AddCommand(GLAuthCommand)
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
"net/http"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis/pkg/flagset"
|
||||
"github.com/owncloud/ocis/ocis/pkg/register"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
@@ -15,7 +14,9 @@ func Health(cfg *config.Config) *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "health",
|
||||
Usage: "Check health status",
|
||||
Flags: flagset.HealthWithConfig(cfg),
|
||||
Before: func(c *cli.Context) error {
|
||||
return ParseConfig(c, cfg)
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
logger := NewLogger(cfg)
|
||||
|
||||
|
||||
@@ -2,10 +2,7 @@ package command
|
||||
|
||||
import (
|
||||
"github.com/owncloud/ocis/idp/pkg/command"
|
||||
svcconfig "github.com/owncloud/ocis/idp/pkg/config"
|
||||
"github.com/owncloud/ocis/idp/pkg/flagset"
|
||||
"github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/version"
|
||||
"github.com/owncloud/ocis/ocis/pkg/register"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
@@ -16,16 +13,22 @@ func IDPCommand(cfg *config.Config) *cli.Command {
|
||||
Name: "idp",
|
||||
Usage: "Start idp server",
|
||||
Category: "Extensions",
|
||||
Flags: flagset.ServerWithConfig(cfg.IDP),
|
||||
Subcommands: []*cli.Command{
|
||||
command.PrintVersion(cfg.IDP),
|
||||
},
|
||||
Before: func(ctx *cli.Context) error {
|
||||
return ParseConfig(ctx, cfg)
|
||||
if err := ParseConfig(ctx, cfg); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if cfg.Commons != nil {
|
||||
cfg.IDP.Commons = cfg.Commons
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
idpCommand := command.Server(configureIDP(cfg))
|
||||
|
||||
idpCommand := command.Server(cfg.IDP)
|
||||
if err := idpCommand.Before(c); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -35,23 +38,6 @@ func IDPCommand(cfg *config.Config) *cli.Command {
|
||||
}
|
||||
}
|
||||
|
||||
func configureIDP(cfg *config.Config) *svcconfig.Config {
|
||||
cfg.IDP.Log.Level = cfg.Log.Level
|
||||
cfg.IDP.Log.Pretty = cfg.Log.Pretty
|
||||
cfg.IDP.Log.Color = cfg.Log.Color
|
||||
cfg.IDP.HTTP.TLS = false
|
||||
cfg.IDP.Service.Version = version.String
|
||||
|
||||
if cfg.Tracing.Enabled {
|
||||
cfg.IDP.Tracing.Enabled = cfg.Tracing.Enabled
|
||||
cfg.IDP.Tracing.Type = cfg.Tracing.Type
|
||||
cfg.IDP.Tracing.Endpoint = cfg.Tracing.Endpoint
|
||||
cfg.IDP.Tracing.Collector = cfg.Tracing.Collector
|
||||
}
|
||||
|
||||
return cfg.IDP
|
||||
}
|
||||
|
||||
func init() {
|
||||
register.AddCommand(IDPCommand)
|
||||
}
|
||||
|
||||
@@ -5,11 +5,8 @@ package command
|
||||
|
||||
import (
|
||||
"github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/version"
|
||||
"github.com/owncloud/ocis/ocis/pkg/register"
|
||||
"github.com/owncloud/ocis/ocs/pkg/command"
|
||||
svcconfig "github.com/owncloud/ocis/ocs/pkg/config"
|
||||
"github.com/owncloud/ocis/ocs/pkg/flagset"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
@@ -19,40 +16,27 @@ func OCSCommand(cfg *config.Config) *cli.Command {
|
||||
Name: "ocs",
|
||||
Usage: "Start ocs server",
|
||||
Category: "Extensions",
|
||||
Flags: flagset.ServerWithConfig(cfg.OCS),
|
||||
Before: func(ctx *cli.Context) error {
|
||||
if err := ParseConfig(ctx, cfg); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if cfg.Commons != nil {
|
||||
cfg.OCS.Commons = cfg.Commons
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
origCmd := command.Server(cfg.OCS)
|
||||
return handleOriginalAction(c, origCmd)
|
||||
},
|
||||
Subcommands: []*cli.Command{
|
||||
command.PrintVersion(cfg.OCS),
|
||||
},
|
||||
Before: func(ctx *cli.Context) error {
|
||||
return ParseConfig(ctx, cfg)
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
origCmd := command.Server(configureOCS(cfg))
|
||||
return handleOriginalAction(c, origCmd)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func configureOCS(cfg *config.Config) *svcconfig.Config {
|
||||
cfg.OCS.Log.Level = cfg.Log.Level
|
||||
cfg.OCS.Log.Pretty = cfg.Log.Pretty
|
||||
cfg.OCS.Log.Color = cfg.Log.Color
|
||||
cfg.OCS.Service.Version = version.String
|
||||
|
||||
if cfg.Tracing.Enabled {
|
||||
cfg.OCS.Tracing.Enabled = cfg.Tracing.Enabled
|
||||
cfg.OCS.Tracing.Type = cfg.Tracing.Type
|
||||
cfg.OCS.Tracing.Endpoint = cfg.Tracing.Endpoint
|
||||
cfg.OCS.Tracing.Collector = cfg.Tracing.Collector
|
||||
}
|
||||
|
||||
if cfg.TokenManager.JWTSecret != "" {
|
||||
cfg.OCS.TokenManager.JWTSecret = cfg.TokenManager.JWTSecret
|
||||
}
|
||||
|
||||
return cfg.OCS
|
||||
}
|
||||
|
||||
func init() {
|
||||
register.AddCommand(OCSCommand)
|
||||
}
|
||||
|
||||
@@ -5,11 +5,8 @@ package command
|
||||
|
||||
import (
|
||||
"github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/version"
|
||||
"github.com/owncloud/ocis/ocis/pkg/register"
|
||||
"github.com/owncloud/ocis/proxy/pkg/command"
|
||||
svcconfig "github.com/owncloud/ocis/proxy/pkg/config"
|
||||
"github.com/owncloud/ocis/proxy/pkg/flagset"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
@@ -19,40 +16,27 @@ func ProxyCommand(cfg *config.Config) *cli.Command {
|
||||
Name: "proxy",
|
||||
Usage: "Start proxy server",
|
||||
Category: "Extensions",
|
||||
Flags: flagset.ServerWithConfig(cfg.Proxy),
|
||||
Subcommands: []*cli.Command{
|
||||
command.PrintVersion(cfg.Proxy),
|
||||
},
|
||||
Before: func(ctx *cli.Context) error {
|
||||
return ParseConfig(ctx, cfg)
|
||||
if err := ParseConfig(ctx, cfg); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if cfg.Commons != nil {
|
||||
cfg.Proxy.Commons = cfg.Commons
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
origCmd := command.Server(configureProxy(cfg))
|
||||
origCmd := command.Server(cfg.Proxy)
|
||||
return handleOriginalAction(c, origCmd)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func configureProxy(cfg *config.Config) *svcconfig.Config {
|
||||
cfg.Proxy.Log.Level = cfg.Log.Level
|
||||
cfg.Proxy.Log.Pretty = cfg.Log.Pretty
|
||||
cfg.Proxy.Log.Color = cfg.Log.Color
|
||||
cfg.Proxy.Service.Version = version.String
|
||||
|
||||
if cfg.Tracing.Enabled {
|
||||
cfg.Proxy.Tracing.Enabled = cfg.Tracing.Enabled
|
||||
cfg.Proxy.Tracing.Type = cfg.Tracing.Type
|
||||
cfg.Proxy.Tracing.Endpoint = cfg.Tracing.Endpoint
|
||||
cfg.Proxy.Tracing.Collector = cfg.Tracing.Collector
|
||||
}
|
||||
|
||||
if cfg.TokenManager.JWTSecret != "" {
|
||||
cfg.Proxy.TokenManager.JWTSecret = cfg.TokenManager.JWTSecret
|
||||
}
|
||||
|
||||
return cfg.Proxy
|
||||
}
|
||||
|
||||
func init() {
|
||||
register.AddCommand(ProxyCommand)
|
||||
}
|
||||
|
||||
@@ -2,41 +2,33 @@ package command
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/sync"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/log"
|
||||
"github.com/urfave/cli/v2"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/config"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/log"
|
||||
"github.com/owncloud/ocis/ocis-pkg/version"
|
||||
"github.com/owncloud/ocis/ocis/pkg/flagset"
|
||||
"github.com/owncloud/ocis/ocis/pkg/register"
|
||||
"github.com/spf13/viper"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
// Execute is the entry point for the ocis command.
|
||||
func Execute() error {
|
||||
cfg := config.New()
|
||||
cfg := config.DefaultConfig()
|
||||
|
||||
app := &cli.App{
|
||||
Name: "ocis",
|
||||
Version: version.String,
|
||||
Usage: "ownCloud Infinite Scale Stack",
|
||||
Compiled: version.Compiled(),
|
||||
|
||||
Before: func(c *cli.Context) error {
|
||||
return ParseConfig(c, cfg)
|
||||
},
|
||||
|
||||
Authors: []*cli.Author{
|
||||
{
|
||||
Name: "ownCloud GmbH",
|
||||
Email: "support@owncloud.com",
|
||||
},
|
||||
},
|
||||
Flags: flagset.RootWithConfig(cfg),
|
||||
}
|
||||
|
||||
for _, fn := range register.Commands {
|
||||
@@ -70,47 +62,15 @@ func NewLogger(cfg *config.Config) log.Logger {
|
||||
)
|
||||
}
|
||||
|
||||
// ParseConfig load configuration for every extension
|
||||
// ParseConfig loads ocis configuration.
|
||||
func ParseConfig(c *cli.Context, cfg *config.Config) error {
|
||||
sync.ParsingViperConfig.Lock()
|
||||
defer sync.ParsingViperConfig.Unlock()
|
||||
logger := NewLogger(cfg)
|
||||
|
||||
viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
|
||||
viper.SetEnvPrefix("OCIS")
|
||||
viper.AutomaticEnv()
|
||||
|
||||
if c.IsSet("config-file") {
|
||||
viper.SetConfigFile(c.String("config-file"))
|
||||
} else {
|
||||
viper.SetConfigName("ocis")
|
||||
|
||||
viper.AddConfigPath("/etc/ocis")
|
||||
viper.AddConfigPath("$HOME/.ocis")
|
||||
viper.AddConfigPath("./config")
|
||||
conf, err := ociscfg.BindSourcesToStructs("ocis", cfg)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := viper.ReadInConfig(); err != nil {
|
||||
switch err.(type) {
|
||||
case viper.ConfigFileNotFoundError:
|
||||
logger.Debug().
|
||||
Msg("no config found on preconfigured location")
|
||||
case viper.UnsupportedConfigError:
|
||||
logger.Fatal().
|
||||
Err(err).
|
||||
Msg("unsupported config type")
|
||||
default:
|
||||
logger.Fatal().
|
||||
Err(err).
|
||||
Msg("failed to read config")
|
||||
}
|
||||
}
|
||||
conf.LoadOSEnv(config.GetEnv(), false)
|
||||
|
||||
if err := viper.Unmarshal(&cfg); err != nil {
|
||||
logger.Fatal().
|
||||
Err(err).
|
||||
Msg("failed to parse config")
|
||||
}
|
||||
|
||||
return nil
|
||||
bindings := config.StructMappings(cfg)
|
||||
return ociscfg.BindEnv(conf, bindings)
|
||||
}
|
||||
|
||||
@@ -6,8 +6,9 @@ package command
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/shared"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis/pkg/flagset"
|
||||
"github.com/owncloud/ocis/ocis/pkg/register"
|
||||
"github.com/owncloud/ocis/ocis/pkg/runtime"
|
||||
"github.com/urfave/cli/v2"
|
||||
@@ -19,15 +20,19 @@ func Server(cfg *config.Config) *cli.Command {
|
||||
Name: "server",
|
||||
Usage: "Start fullstack server",
|
||||
Category: "Fullstack",
|
||||
Flags: flagset.ServerWithConfig(cfg),
|
||||
Before: func(c *cli.Context) error {
|
||||
if cfg.HTTP.Root != "/" {
|
||||
cfg.HTTP.Root = strings.TrimSuffix(cfg.HTTP.Root, "/")
|
||||
}
|
||||
|
||||
return nil
|
||||
return ParseConfig(c, cfg)
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
|
||||
cfg.Commons = &shared.Commons{
|
||||
Log: &cfg.Log,
|
||||
}
|
||||
|
||||
r := runtime.New(cfg)
|
||||
return r.Start()
|
||||
},
|
||||
|
||||
@@ -5,11 +5,8 @@ package command
|
||||
|
||||
import (
|
||||
"github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/version"
|
||||
"github.com/owncloud/ocis/ocis/pkg/register"
|
||||
"github.com/owncloud/ocis/settings/pkg/command"
|
||||
svcconfig "github.com/owncloud/ocis/settings/pkg/config"
|
||||
"github.com/owncloud/ocis/settings/pkg/flagset"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
@@ -19,40 +16,27 @@ func SettingsCommand(cfg *config.Config) *cli.Command {
|
||||
Name: "settings",
|
||||
Usage: "Start settings server",
|
||||
Category: "Extensions",
|
||||
Flags: flagset.ServerWithConfig(cfg.Settings),
|
||||
Subcommands: []*cli.Command{
|
||||
command.PrintVersion(cfg.Settings),
|
||||
},
|
||||
Before: func(ctx *cli.Context) error {
|
||||
return ParseConfig(ctx, cfg)
|
||||
if err := ParseConfig(ctx, cfg); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if cfg.Commons != nil {
|
||||
cfg.Settings.Commons = cfg.Commons
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
origCmd := command.Server(configureSettings(cfg))
|
||||
origCmd := command.Server(cfg.Settings)
|
||||
return handleOriginalAction(c, origCmd)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func configureSettings(cfg *config.Config) *svcconfig.Config {
|
||||
cfg.Settings.Log.Level = cfg.Log.Level
|
||||
cfg.Settings.Log.Pretty = cfg.Log.Pretty
|
||||
cfg.Settings.Log.Color = cfg.Log.Color
|
||||
cfg.Settings.Service.Version = version.String
|
||||
|
||||
if cfg.Tracing.Enabled {
|
||||
cfg.Settings.Tracing.Enabled = cfg.Tracing.Enabled
|
||||
cfg.Settings.Tracing.Type = cfg.Tracing.Type
|
||||
cfg.Settings.Tracing.Endpoint = cfg.Tracing.Endpoint
|
||||
cfg.Settings.Tracing.Collector = cfg.Tracing.Collector
|
||||
}
|
||||
|
||||
if cfg.TokenManager.JWTSecret != "" {
|
||||
cfg.Settings.TokenManager.JWTSecret = cfg.TokenManager.JWTSecret
|
||||
}
|
||||
|
||||
return cfg.Settings
|
||||
}
|
||||
|
||||
func init() {
|
||||
register.AddCommand(SettingsCommand)
|
||||
}
|
||||
|
||||
@@ -7,8 +7,6 @@ import (
|
||||
"github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis/pkg/register"
|
||||
"github.com/owncloud/ocis/storage/pkg/command"
|
||||
svcconfig "github.com/owncloud/ocis/storage/pkg/config"
|
||||
"github.com/owncloud/ocis/storage/pkg/flagset"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
@@ -18,29 +16,17 @@ func StorageAppProviderCommand(cfg *config.Config) *cli.Command {
|
||||
Name: "storage-app-provider",
|
||||
Usage: "Start storage app-provider service",
|
||||
Category: "Extensions",
|
||||
Flags: flagset.AppProviderWithConfig(cfg.Storage),
|
||||
//Flags: flagset.AppProviderWithConfig(cfg.Storage),
|
||||
Before: func(ctx *cli.Context) error {
|
||||
return ParseStorageCommon(ctx, cfg)
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
origCmd := command.AppProvider(configureStorageAppProvider(cfg))
|
||||
origCmd := command.AppProvider(cfg.Storage)
|
||||
return handleOriginalAction(c, origCmd)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func configureStorageAppProvider(cfg *config.Config) *svcconfig.Config {
|
||||
cfg.Storage.Log.Level = cfg.Log.Level
|
||||
cfg.Storage.Log.Pretty = cfg.Log.Pretty
|
||||
cfg.Storage.Log.Color = cfg.Log.Color
|
||||
|
||||
if cfg.Tracing.Enabled {
|
||||
cfg.Storage.Tracing.Enabled = cfg.Tracing.Enabled
|
||||
cfg.Storage.Tracing.Type = cfg.Tracing.Type
|
||||
cfg.Storage.Tracing.Endpoint = cfg.Tracing.Endpoint
|
||||
cfg.Storage.Tracing.Collector = cfg.Tracing.Collector
|
||||
}
|
||||
|
||||
return cfg.Storage
|
||||
}
|
||||
|
||||
func init() {
|
||||
register.AddCommand(StorageAppProviderCommand)
|
||||
}
|
||||
|
||||
@@ -7,8 +7,6 @@ import (
|
||||
"github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis/pkg/register"
|
||||
"github.com/owncloud/ocis/storage/pkg/command"
|
||||
svcconfig "github.com/owncloud/ocis/storage/pkg/config"
|
||||
"github.com/owncloud/ocis/storage/pkg/flagset"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
@@ -18,29 +16,17 @@ func StorageAuthBasicCommand(cfg *config.Config) *cli.Command {
|
||||
Name: "storage-auth-basic",
|
||||
Usage: "Start storage auth-basic service",
|
||||
Category: "Extensions",
|
||||
Flags: flagset.AuthBasicWithConfig(cfg.Storage),
|
||||
//Flags: flagset.AuthBasicWithConfig(cfg.Storage),
|
||||
Before: func(ctx *cli.Context) error {
|
||||
return ParseStorageCommon(ctx, cfg)
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
origCmd := command.AuthBasic(configureStorageAuthBasic(cfg))
|
||||
origCmd := command.AuthBasic(cfg.Storage)
|
||||
return handleOriginalAction(c, origCmd)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func configureStorageAuthBasic(cfg *config.Config) *svcconfig.Config {
|
||||
cfg.Storage.Log.Level = cfg.Log.Level
|
||||
cfg.Storage.Log.Pretty = cfg.Log.Pretty
|
||||
cfg.Storage.Log.Color = cfg.Log.Color
|
||||
|
||||
if cfg.Tracing.Enabled {
|
||||
cfg.Storage.Tracing.Enabled = cfg.Tracing.Enabled
|
||||
cfg.Storage.Tracing.Type = cfg.Tracing.Type
|
||||
cfg.Storage.Tracing.Endpoint = cfg.Tracing.Endpoint
|
||||
cfg.Storage.Tracing.Collector = cfg.Tracing.Collector
|
||||
}
|
||||
|
||||
return cfg.Storage
|
||||
}
|
||||
|
||||
func init() {
|
||||
register.AddCommand(StorageAuthBasicCommand)
|
||||
}
|
||||
|
||||
@@ -7,8 +7,6 @@ import (
|
||||
"github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis/pkg/register"
|
||||
"github.com/owncloud/ocis/storage/pkg/command"
|
||||
svcconfig "github.com/owncloud/ocis/storage/pkg/config"
|
||||
"github.com/owncloud/ocis/storage/pkg/flagset"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
@@ -18,29 +16,17 @@ func StorageAuthBearerCommand(cfg *config.Config) *cli.Command {
|
||||
Name: "storage-auth-bearer",
|
||||
Usage: "Start storage auth-bearer service",
|
||||
Category: "Extensions",
|
||||
Flags: flagset.AuthBearerWithConfig(cfg.Storage),
|
||||
//Flags: flagset.AuthBearerWithConfig(cfg.Storage),
|
||||
Before: func(ctx *cli.Context) error {
|
||||
return ParseStorageCommon(ctx, cfg)
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
origCmd := command.AuthBearer(configureStorageAuthBearer(cfg))
|
||||
origCmd := command.AuthBearer(cfg.Storage)
|
||||
return handleOriginalAction(c, origCmd)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func configureStorageAuthBearer(cfg *config.Config) *svcconfig.Config {
|
||||
cfg.Storage.Log.Level = cfg.Log.Level
|
||||
cfg.Storage.Log.Pretty = cfg.Log.Pretty
|
||||
cfg.Storage.Log.Color = cfg.Log.Color
|
||||
|
||||
if cfg.Tracing.Enabled {
|
||||
cfg.Storage.Tracing.Enabled = cfg.Tracing.Enabled
|
||||
cfg.Storage.Tracing.Type = cfg.Tracing.Type
|
||||
cfg.Storage.Tracing.Endpoint = cfg.Tracing.Endpoint
|
||||
cfg.Storage.Tracing.Collector = cfg.Tracing.Collector
|
||||
}
|
||||
|
||||
return cfg.Storage
|
||||
}
|
||||
|
||||
func init() {
|
||||
register.AddCommand(StorageAuthBearerCommand)
|
||||
}
|
||||
|
||||
@@ -7,8 +7,6 @@ import (
|
||||
"github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis/pkg/register"
|
||||
"github.com/owncloud/ocis/storage/pkg/command"
|
||||
svcconfig "github.com/owncloud/ocis/storage/pkg/config"
|
||||
"github.com/owncloud/ocis/storage/pkg/flagset"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
@@ -18,29 +16,17 @@ func StorageFrontendCommand(cfg *config.Config) *cli.Command {
|
||||
Name: "storage-frontend",
|
||||
Usage: "Start storage frontend",
|
||||
Category: "Extensions",
|
||||
Flags: flagset.FrontendWithConfig(cfg.Storage),
|
||||
//Flags: flagset.FrontendWithConfig(cfg.Storage),
|
||||
Before: func(ctx *cli.Context) error {
|
||||
return ParseStorageCommon(ctx, cfg)
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
origCmd := command.Frontend(configureStorageFrontend(cfg))
|
||||
origCmd := command.Frontend(cfg.Storage)
|
||||
return handleOriginalAction(c, origCmd)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func configureStorageFrontend(cfg *config.Config) *svcconfig.Config {
|
||||
cfg.Storage.Log.Level = cfg.Log.Level
|
||||
cfg.Storage.Log.Pretty = cfg.Log.Pretty
|
||||
cfg.Storage.Log.Color = cfg.Log.Color
|
||||
|
||||
if cfg.Tracing.Enabled {
|
||||
cfg.Storage.Tracing.Enabled = cfg.Tracing.Enabled
|
||||
cfg.Storage.Tracing.Type = cfg.Tracing.Type
|
||||
cfg.Storage.Tracing.Endpoint = cfg.Tracing.Endpoint
|
||||
cfg.Storage.Tracing.Collector = cfg.Tracing.Collector
|
||||
}
|
||||
|
||||
return cfg.Storage
|
||||
}
|
||||
|
||||
func init() {
|
||||
register.AddCommand(StorageFrontendCommand)
|
||||
}
|
||||
|
||||
@@ -7,8 +7,6 @@ import (
|
||||
"github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis/pkg/register"
|
||||
"github.com/owncloud/ocis/storage/pkg/command"
|
||||
svcconfig "github.com/owncloud/ocis/storage/pkg/config"
|
||||
"github.com/owncloud/ocis/storage/pkg/flagset"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
@@ -18,29 +16,17 @@ func StorageGatewayCommand(cfg *config.Config) *cli.Command {
|
||||
Name: "storage-gateway",
|
||||
Usage: "Start storage gateway",
|
||||
Category: "Extensions",
|
||||
Flags: flagset.GatewayWithConfig(cfg.Storage),
|
||||
//Flags: flagset.GatewayWithConfig(cfg.Storage),
|
||||
Before: func(ctx *cli.Context) error {
|
||||
return ParseStorageCommon(ctx, cfg)
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
origCmd := command.Gateway(configureStorageGateway(cfg))
|
||||
origCmd := command.Gateway(cfg.Storage)
|
||||
return handleOriginalAction(c, origCmd)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func configureStorageGateway(cfg *config.Config) *svcconfig.Config {
|
||||
cfg.Storage.Log.Level = cfg.Log.Level
|
||||
cfg.Storage.Log.Pretty = cfg.Log.Pretty
|
||||
cfg.Storage.Log.Color = cfg.Log.Color
|
||||
|
||||
if cfg.Tracing.Enabled {
|
||||
cfg.Storage.Tracing.Enabled = cfg.Tracing.Enabled
|
||||
cfg.Storage.Tracing.Type = cfg.Tracing.Type
|
||||
cfg.Storage.Tracing.Endpoint = cfg.Tracing.Endpoint
|
||||
cfg.Storage.Tracing.Collector = cfg.Tracing.Collector
|
||||
}
|
||||
|
||||
return cfg.Storage
|
||||
}
|
||||
|
||||
func init() {
|
||||
register.AddCommand(StorageGatewayCommand)
|
||||
}
|
||||
|
||||
@@ -7,8 +7,6 @@ import (
|
||||
"github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis/pkg/register"
|
||||
"github.com/owncloud/ocis/storage/pkg/command"
|
||||
svcconfig "github.com/owncloud/ocis/storage/pkg/config"
|
||||
"github.com/owncloud/ocis/storage/pkg/flagset"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
@@ -18,29 +16,17 @@ func StorageGroupProviderCommand(cfg *config.Config) *cli.Command {
|
||||
Name: "storage-groupprovider",
|
||||
Usage: "Start storage groupprovider service",
|
||||
Category: "Extensions",
|
||||
Flags: flagset.GroupsWithConfig(cfg.Storage),
|
||||
//Flags: flagset.GroupsWithConfig(cfg.Storage),
|
||||
Before: func(ctx *cli.Context) error {
|
||||
return ParseStorageCommon(ctx, cfg)
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
origCmd := command.Groups(configureStorageGroupProvider(cfg))
|
||||
origCmd := command.Groups(cfg.Storage)
|
||||
return handleOriginalAction(c, origCmd)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func configureStorageGroupProvider(cfg *config.Config) *svcconfig.Config {
|
||||
cfg.Storage.Log.Level = cfg.Log.Level
|
||||
cfg.Storage.Log.Pretty = cfg.Log.Pretty
|
||||
cfg.Storage.Log.Color = cfg.Log.Color
|
||||
|
||||
if cfg.Tracing.Enabled {
|
||||
cfg.Storage.Tracing.Enabled = cfg.Tracing.Enabled
|
||||
cfg.Storage.Tracing.Type = cfg.Tracing.Type
|
||||
cfg.Storage.Tracing.Endpoint = cfg.Tracing.Endpoint
|
||||
cfg.Storage.Tracing.Collector = cfg.Tracing.Collector
|
||||
}
|
||||
|
||||
return cfg.Storage
|
||||
}
|
||||
|
||||
func init() {
|
||||
register.AddCommand(StorageGroupProviderCommand)
|
||||
}
|
||||
|
||||
@@ -7,8 +7,6 @@ import (
|
||||
"github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis/pkg/register"
|
||||
"github.com/owncloud/ocis/storage/pkg/command"
|
||||
svcconfig "github.com/owncloud/ocis/storage/pkg/config"
|
||||
"github.com/owncloud/ocis/storage/pkg/flagset"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
@@ -18,29 +16,17 @@ func StorageHomeCommand(cfg *config.Config) *cli.Command {
|
||||
Name: "storage-home",
|
||||
Usage: "Start storage and data provider for /home mount",
|
||||
Category: "Extensions",
|
||||
Flags: flagset.StorageHomeWithConfig(cfg.Storage),
|
||||
//Flags: flagset.StorageHomeWithConfig(cfg.Storage),
|
||||
Before: func(ctx *cli.Context) error {
|
||||
return ParseStorageCommon(ctx, cfg)
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
origCmd := command.StorageHome(configureStorageHome(cfg))
|
||||
origCmd := command.StorageHome(cfg.Storage)
|
||||
return handleOriginalAction(c, origCmd)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func configureStorageHome(cfg *config.Config) *svcconfig.Config {
|
||||
cfg.Storage.Log.Level = cfg.Log.Level
|
||||
cfg.Storage.Log.Pretty = cfg.Log.Pretty
|
||||
cfg.Storage.Log.Color = cfg.Log.Color
|
||||
|
||||
if cfg.Tracing.Enabled {
|
||||
cfg.Storage.Tracing.Enabled = cfg.Tracing.Enabled
|
||||
cfg.Storage.Tracing.Type = cfg.Tracing.Type
|
||||
cfg.Storage.Tracing.Endpoint = cfg.Tracing.Endpoint
|
||||
cfg.Storage.Tracing.Collector = cfg.Tracing.Collector
|
||||
}
|
||||
|
||||
return cfg.Storage
|
||||
}
|
||||
|
||||
func init() {
|
||||
register.AddCommand(StorageHomeCommand)
|
||||
}
|
||||
|
||||
@@ -4,8 +4,6 @@ import (
|
||||
"github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis/pkg/register"
|
||||
"github.com/owncloud/ocis/storage/pkg/command"
|
||||
svcconfig "github.com/owncloud/ocis/storage/pkg/config"
|
||||
"github.com/owncloud/ocis/storage/pkg/flagset"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
@@ -15,29 +13,17 @@ func StorageMetadataCommand(cfg *config.Config) *cli.Command {
|
||||
Name: "storage-metadata",
|
||||
Usage: "Start storage and data service for metadata",
|
||||
Category: "Extensions",
|
||||
Flags: flagset.StorageMetadata(cfg.Storage),
|
||||
//Flags: flagset.StorageMetadata(cfg.Storage),
|
||||
Before: func(ctx *cli.Context) error {
|
||||
return ParseStorageCommon(ctx, cfg)
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
origCmd := command.StorageMetadata(configureStorageMetadata(cfg))
|
||||
origCmd := command.StorageMetadata(cfg.Storage)
|
||||
return handleOriginalAction(c, origCmd)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func configureStorageMetadata(cfg *config.Config) *svcconfig.Config {
|
||||
cfg.Storage.Log.Level = cfg.Log.Level
|
||||
cfg.Storage.Log.Pretty = cfg.Log.Pretty
|
||||
cfg.Storage.Log.Color = cfg.Log.Color
|
||||
|
||||
if cfg.Tracing.Enabled {
|
||||
cfg.Storage.Tracing.Enabled = cfg.Tracing.Enabled
|
||||
cfg.Storage.Tracing.Type = cfg.Tracing.Type
|
||||
cfg.Storage.Tracing.Endpoint = cfg.Tracing.Endpoint
|
||||
cfg.Storage.Tracing.Collector = cfg.Tracing.Collector
|
||||
}
|
||||
|
||||
return cfg.Storage
|
||||
}
|
||||
|
||||
func init() {
|
||||
register.AddCommand(StorageMetadataCommand)
|
||||
}
|
||||
|
||||
@@ -7,8 +7,6 @@ import (
|
||||
"github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis/pkg/register"
|
||||
"github.com/owncloud/ocis/storage/pkg/command"
|
||||
svcconfig "github.com/owncloud/ocis/storage/pkg/config"
|
||||
"github.com/owncloud/ocis/storage/pkg/flagset"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
@@ -18,29 +16,17 @@ func StoragePublicLinkCommand(cfg *config.Config) *cli.Command {
|
||||
Name: "storage-public-link",
|
||||
Usage: "Start storage public link storage",
|
||||
Category: "Extensions",
|
||||
Flags: flagset.StoragePublicLink(cfg.Storage),
|
||||
//Flags: flagset.StoragePublicLink(cfg.Storage),
|
||||
Before: func(ctx *cli.Context) error {
|
||||
return ParseStorageCommon(ctx, cfg)
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
origCmd := command.StoragePublicLink(configureStoragePublicLink(cfg))
|
||||
origCmd := command.StoragePublicLink(cfg.Storage)
|
||||
return handleOriginalAction(c, origCmd)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func configureStoragePublicLink(cfg *config.Config) *svcconfig.Config {
|
||||
cfg.Storage.Log.Level = cfg.Log.Level
|
||||
cfg.Storage.Log.Pretty = cfg.Log.Pretty
|
||||
cfg.Storage.Log.Color = cfg.Log.Color
|
||||
|
||||
if cfg.Tracing.Enabled {
|
||||
cfg.Storage.Tracing.Enabled = cfg.Tracing.Enabled
|
||||
cfg.Storage.Tracing.Type = cfg.Tracing.Type
|
||||
cfg.Storage.Tracing.Endpoint = cfg.Tracing.Endpoint
|
||||
cfg.Storage.Tracing.Collector = cfg.Tracing.Collector
|
||||
}
|
||||
|
||||
return cfg.Storage
|
||||
}
|
||||
|
||||
func init() {
|
||||
register.AddCommand(StoragePublicLinkCommand)
|
||||
}
|
||||
|
||||
@@ -7,8 +7,6 @@ import (
|
||||
"github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis/pkg/register"
|
||||
"github.com/owncloud/ocis/storage/pkg/command"
|
||||
svcconfig "github.com/owncloud/ocis/storage/pkg/config"
|
||||
"github.com/owncloud/ocis/storage/pkg/flagset"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
@@ -18,29 +16,17 @@ func StorageSharingCommand(cfg *config.Config) *cli.Command {
|
||||
Name: "storage-sharing",
|
||||
Usage: "Start storage sharing service",
|
||||
Category: "Extensions",
|
||||
Flags: flagset.SharingWithConfig(cfg.Storage),
|
||||
//Flags: flagset.SharingWithConfig(cfg.Storage),
|
||||
Before: func(ctx *cli.Context) error {
|
||||
return ParseStorageCommon(ctx, cfg)
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
origCmd := command.Sharing(configureStorageSharing(cfg))
|
||||
origCmd := command.Sharing(cfg.Storage)
|
||||
return handleOriginalAction(c, origCmd)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func configureStorageSharing(cfg *config.Config) *svcconfig.Config {
|
||||
cfg.Storage.Log.Level = cfg.Log.Level
|
||||
cfg.Storage.Log.Pretty = cfg.Log.Pretty
|
||||
cfg.Storage.Log.Color = cfg.Log.Color
|
||||
|
||||
if cfg.Tracing.Enabled {
|
||||
cfg.Storage.Tracing.Enabled = cfg.Tracing.Enabled
|
||||
cfg.Storage.Tracing.Type = cfg.Tracing.Type
|
||||
cfg.Storage.Tracing.Endpoint = cfg.Tracing.Endpoint
|
||||
cfg.Storage.Tracing.Collector = cfg.Tracing.Collector
|
||||
}
|
||||
|
||||
return cfg.Storage
|
||||
}
|
||||
|
||||
func init() {
|
||||
register.AddCommand(StorageSharingCommand)
|
||||
}
|
||||
|
||||
@@ -7,8 +7,6 @@ import (
|
||||
"github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis/pkg/register"
|
||||
"github.com/owncloud/ocis/storage/pkg/command"
|
||||
svcconfig "github.com/owncloud/ocis/storage/pkg/config"
|
||||
"github.com/owncloud/ocis/storage/pkg/flagset"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
@@ -18,29 +16,17 @@ func StorageUserProviderCommand(cfg *config.Config) *cli.Command {
|
||||
Name: "storage-userprovider",
|
||||
Usage: "Start storage userprovider service",
|
||||
Category: "Extensions",
|
||||
Flags: flagset.UsersWithConfig(cfg.Storage),
|
||||
//Flags: flagset.UsersWithConfig(cfg.Storage),
|
||||
Before: func(ctx *cli.Context) error {
|
||||
return ParseStorageCommon(ctx, cfg)
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
origCmd := command.Users(configureStorageUserProvider(cfg))
|
||||
origCmd := command.Users(cfg.Storage)
|
||||
return handleOriginalAction(c, origCmd)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func configureStorageUserProvider(cfg *config.Config) *svcconfig.Config {
|
||||
cfg.Storage.Log.Level = cfg.Log.Level
|
||||
cfg.Storage.Log.Pretty = cfg.Log.Pretty
|
||||
cfg.Storage.Log.Color = cfg.Log.Color
|
||||
|
||||
if cfg.Tracing.Enabled {
|
||||
cfg.Storage.Tracing.Enabled = cfg.Tracing.Enabled
|
||||
cfg.Storage.Tracing.Type = cfg.Tracing.Type
|
||||
cfg.Storage.Tracing.Endpoint = cfg.Tracing.Endpoint
|
||||
cfg.Storage.Tracing.Collector = cfg.Tracing.Collector
|
||||
}
|
||||
|
||||
return cfg.Storage
|
||||
}
|
||||
|
||||
func init() {
|
||||
register.AddCommand(StorageUserProviderCommand)
|
||||
}
|
||||
|
||||
@@ -7,8 +7,6 @@ import (
|
||||
"github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis/pkg/register"
|
||||
"github.com/owncloud/ocis/storage/pkg/command"
|
||||
svcconfig "github.com/owncloud/ocis/storage/pkg/config"
|
||||
"github.com/owncloud/ocis/storage/pkg/flagset"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
@@ -18,29 +16,17 @@ func StorageUsersCommand(cfg *config.Config) *cli.Command {
|
||||
Name: "storage-users",
|
||||
Usage: "Start storage and data provider for /users mount",
|
||||
Category: "Extensions",
|
||||
Flags: flagset.StorageUsersWithConfig(cfg.Storage),
|
||||
//Flags: flagset.StorageUsersWithConfig(cfg.Storage),
|
||||
Before: func(ctx *cli.Context) error {
|
||||
return ParseStorageCommon(ctx, cfg)
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
origCmd := command.StorageUsers(configureStorageUsers(cfg))
|
||||
origCmd := command.StorageUsers(cfg.Storage)
|
||||
return handleOriginalAction(c, origCmd)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func configureStorageUsers(cfg *config.Config) *svcconfig.Config {
|
||||
cfg.Storage.Log.Level = cfg.Log.Level
|
||||
cfg.Storage.Log.Pretty = cfg.Log.Pretty
|
||||
cfg.Storage.Log.Color = cfg.Log.Color
|
||||
|
||||
if cfg.Tracing.Enabled {
|
||||
cfg.Storage.Tracing.Enabled = cfg.Tracing.Enabled
|
||||
cfg.Storage.Tracing.Type = cfg.Tracing.Type
|
||||
cfg.Storage.Tracing.Endpoint = cfg.Tracing.Endpoint
|
||||
cfg.Storage.Tracing.Collector = cfg.Tracing.Collector
|
||||
}
|
||||
|
||||
return cfg.Storage
|
||||
}
|
||||
|
||||
func init() {
|
||||
register.AddCommand(StorageUsersCommand)
|
||||
}
|
||||
|
||||
@@ -5,50 +5,45 @@ package command
|
||||
|
||||
import (
|
||||
"github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/version"
|
||||
"github.com/owncloud/ocis/ocis-pkg/shared"
|
||||
"github.com/owncloud/ocis/ocis/pkg/register"
|
||||
"github.com/owncloud/ocis/store/pkg/command"
|
||||
svcconfig "github.com/owncloud/ocis/store/pkg/config"
|
||||
"github.com/owncloud/ocis/store/pkg/flagset"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
// StoreCommand is the entrypoint for the ocs command.
|
||||
func StoreCommand(cfg *config.Config) *cli.Command {
|
||||
var globalLog shared.Log
|
||||
|
||||
return &cli.Command{
|
||||
Name: "store",
|
||||
Usage: "Start a go-micro store",
|
||||
Category: "Extensions",
|
||||
Flags: flagset.ServerWithConfig(cfg.Store),
|
||||
Subcommands: []*cli.Command{
|
||||
command.PrintVersion(cfg.Store),
|
||||
},
|
||||
Before: func(ctx *cli.Context) error {
|
||||
return ParseConfig(ctx, cfg)
|
||||
if err := ParseConfig(ctx, cfg); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
globalLog = cfg.Log
|
||||
|
||||
return nil
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
origCmd := command.Server(configureStore(cfg))
|
||||
// if accounts logging is empty in ocis.yaml
|
||||
if (cfg.Store.Log == shared.Log{}) && (globalLog != shared.Log{}) {
|
||||
// we can safely inherit the global logging values.
|
||||
cfg.Store.Log = globalLog
|
||||
}
|
||||
|
||||
origCmd := command.Server(cfg.Store)
|
||||
return handleOriginalAction(c, origCmd)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func configureStore(cfg *config.Config) *svcconfig.Config {
|
||||
cfg.Store.Log.Level = cfg.Log.Level
|
||||
cfg.Store.Log.Pretty = cfg.Log.Pretty
|
||||
cfg.Store.Log.Color = cfg.Log.Color
|
||||
cfg.Store.Service.Version = version.String
|
||||
|
||||
if cfg.Tracing.Enabled {
|
||||
cfg.Store.Tracing.Enabled = cfg.Tracing.Enabled
|
||||
cfg.Store.Tracing.Type = cfg.Tracing.Type
|
||||
cfg.Store.Tracing.Endpoint = cfg.Tracing.Endpoint
|
||||
cfg.Store.Tracing.Collector = cfg.Tracing.Collector
|
||||
}
|
||||
|
||||
return cfg.Store
|
||||
}
|
||||
|
||||
func init() {
|
||||
register.AddCommand(StoreCommand)
|
||||
}
|
||||
|
||||
@@ -5,13 +5,9 @@ package command
|
||||
|
||||
import (
|
||||
"github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/version"
|
||||
"github.com/owncloud/ocis/ocis/pkg/register"
|
||||
"github.com/owncloud/ocis/thumbnails/pkg/command"
|
||||
"github.com/owncloud/ocis/thumbnails/pkg/flagset"
|
||||
"github.com/urfave/cli/v2"
|
||||
|
||||
svcconfig "github.com/owncloud/ocis/thumbnails/pkg/config"
|
||||
)
|
||||
|
||||
// ThumbnailsCommand is the entrypoint for the thumbnails command.
|
||||
@@ -20,36 +16,27 @@ func ThumbnailsCommand(cfg *config.Config) *cli.Command {
|
||||
Name: "thumbnails",
|
||||
Usage: "Start thumbnails server",
|
||||
Category: "Extensions",
|
||||
Flags: flagset.ServerWithConfig(cfg.Thumbnails),
|
||||
Subcommands: []*cli.Command{
|
||||
command.PrintVersion(cfg.Thumbnails),
|
||||
},
|
||||
Before: func(ctx *cli.Context) error {
|
||||
return ParseConfig(ctx, cfg)
|
||||
if err := ParseConfig(ctx, cfg); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if cfg.Commons != nil {
|
||||
cfg.Thumbnails.Commons = cfg.Commons
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
origCmd := command.Server(configureThumbnails(cfg))
|
||||
origCmd := command.Server(cfg.Thumbnails)
|
||||
return handleOriginalAction(c, origCmd)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func configureThumbnails(cfg *config.Config) *svcconfig.Config {
|
||||
cfg.Thumbnails.Log.Level = cfg.Log.Level
|
||||
cfg.Thumbnails.Log.Pretty = cfg.Log.Pretty
|
||||
cfg.Thumbnails.Log.Color = cfg.Log.Color
|
||||
cfg.Thumbnails.Server.Version = version.String
|
||||
|
||||
if cfg.Tracing.Enabled {
|
||||
cfg.Thumbnails.Tracing.Enabled = cfg.Tracing.Enabled
|
||||
cfg.Thumbnails.Tracing.Type = cfg.Tracing.Type
|
||||
cfg.Thumbnails.Tracing.Endpoint = cfg.Tracing.Endpoint
|
||||
cfg.Thumbnails.Tracing.Collector = cfg.Tracing.Collector
|
||||
}
|
||||
|
||||
return cfg.Thumbnails
|
||||
}
|
||||
|
||||
func init() {
|
||||
register.AddCommand(ThumbnailsCommand)
|
||||
}
|
||||
|
||||
26
ocis/pkg/command/util.go
Normal file
26
ocis/pkg/command/util.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package command
|
||||
|
||||
import (
|
||||
"github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/shared"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
func ParseStorageCommon(ctx *cli.Context, cfg *config.Config) error {
|
||||
if err := ParseConfig(ctx, cfg); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if cfg.Storage.Log == nil && cfg.Commons != nil && cfg.Commons.Log != nil {
|
||||
cfg.Storage.Log = &shared.Log{
|
||||
Level: cfg.Commons.Log.Level,
|
||||
Pretty: cfg.Commons.Log.Pretty,
|
||||
Color: cfg.Commons.Log.Color,
|
||||
File: cfg.Commons.Log.File,
|
||||
}
|
||||
} else if cfg.Storage.Log == nil && cfg.Commons == nil {
|
||||
cfg.Storage.Log = &shared.Log{}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -4,8 +4,6 @@ import (
|
||||
"github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis/pkg/register"
|
||||
"github.com/owncloud/ocis/web/pkg/command"
|
||||
svcconfig "github.com/owncloud/ocis/web/pkg/config"
|
||||
"github.com/owncloud/ocis/web/pkg/flagset"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
@@ -15,32 +13,24 @@ func WebCommand(cfg *config.Config) *cli.Command {
|
||||
Name: "web",
|
||||
Usage: "Start web server",
|
||||
Category: "Extensions",
|
||||
Flags: flagset.ServerWithConfig(cfg.Web),
|
||||
Before: func(ctx *cli.Context) error {
|
||||
return ParseConfig(ctx, cfg)
|
||||
if err := ParseConfig(ctx, cfg); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if cfg.Commons != nil {
|
||||
cfg.Web.Commons = cfg.Commons
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
origCmd := command.Server(configureWeb(cfg))
|
||||
origCmd := command.Server(cfg.Web)
|
||||
return handleOriginalAction(c, origCmd)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func configureWeb(cfg *config.Config) *svcconfig.Config {
|
||||
cfg.Web.Log.Level = cfg.Log.Level
|
||||
cfg.Web.Log.Pretty = cfg.Log.Pretty
|
||||
cfg.Web.Log.Color = cfg.Log.Color
|
||||
|
||||
if cfg.Tracing.Enabled {
|
||||
cfg.Web.Tracing.Enabled = cfg.Tracing.Enabled
|
||||
cfg.Web.Tracing.Type = cfg.Tracing.Type
|
||||
cfg.Web.Tracing.Endpoint = cfg.Tracing.Endpoint
|
||||
cfg.Web.Tracing.Collector = cfg.Tracing.Collector
|
||||
}
|
||||
|
||||
return cfg.Web
|
||||
}
|
||||
|
||||
func init() {
|
||||
register.AddCommand(WebCommand)
|
||||
}
|
||||
|
||||
@@ -5,50 +5,39 @@ package command
|
||||
|
||||
import (
|
||||
"github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/version"
|
||||
"github.com/owncloud/ocis/ocis/pkg/register"
|
||||
"github.com/owncloud/ocis/webdav/pkg/command"
|
||||
svcconfig "github.com/owncloud/ocis/webdav/pkg/config"
|
||||
"github.com/owncloud/ocis/webdav/pkg/flagset"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
// WebDAVCommand is the entrypoint for the webdav command.
|
||||
func WebDAVCommand(cfg *config.Config) *cli.Command {
|
||||
|
||||
return &cli.Command{
|
||||
Name: "webdav",
|
||||
Usage: "Start webdav server",
|
||||
Category: "Extensions",
|
||||
Flags: flagset.ServerWithConfig(cfg.WebDAV),
|
||||
Subcommands: []*cli.Command{
|
||||
command.PrintVersion(cfg.WebDAV),
|
||||
},
|
||||
Before: func(ctx *cli.Context) error {
|
||||
return ParseConfig(ctx, cfg)
|
||||
if err := ParseConfig(ctx, cfg); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if cfg.Commons != nil {
|
||||
cfg.WebDAV.Commons = cfg.Commons
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
origCmd := command.Server(configureWebDAV(cfg))
|
||||
origCmd := command.Server(cfg.WebDAV)
|
||||
return handleOriginalAction(c, origCmd)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func configureWebDAV(cfg *config.Config) *svcconfig.Config {
|
||||
cfg.WebDAV.Log.Level = cfg.Log.Level
|
||||
cfg.WebDAV.Log.Pretty = cfg.Log.Pretty
|
||||
cfg.WebDAV.Log.Color = cfg.Log.Color
|
||||
cfg.WebDAV.Service.Version = version.String
|
||||
|
||||
if cfg.Tracing.Enabled {
|
||||
cfg.WebDAV.Tracing.Enabled = cfg.Tracing.Enabled
|
||||
cfg.WebDAV.Tracing.Type = cfg.Tracing.Type
|
||||
cfg.WebDAV.Tracing.Endpoint = cfg.Tracing.Endpoint
|
||||
cfg.WebDAV.Tracing.Collector = cfg.Tracing.Collector
|
||||
}
|
||||
|
||||
return cfg.WebDAV
|
||||
}
|
||||
|
||||
func init() {
|
||||
register.AddCommand(WebDAVCommand)
|
||||
}
|
||||
|
||||
@@ -1,104 +0,0 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
accounts "github.com/owncloud/ocis/accounts/pkg/config"
|
||||
glauth "github.com/owncloud/ocis/glauth/pkg/config"
|
||||
graphExplorer "github.com/owncloud/ocis/graph-explorer/pkg/config"
|
||||
graph "github.com/owncloud/ocis/graph/pkg/config"
|
||||
idp "github.com/owncloud/ocis/idp/pkg/config"
|
||||
pman "github.com/owncloud/ocis/ocis/pkg/runtime/config"
|
||||
ocs "github.com/owncloud/ocis/ocs/pkg/config"
|
||||
proxy "github.com/owncloud/ocis/proxy/pkg/config"
|
||||
settings "github.com/owncloud/ocis/settings/pkg/config"
|
||||
storage "github.com/owncloud/ocis/storage/pkg/config"
|
||||
store "github.com/owncloud/ocis/store/pkg/config"
|
||||
thumbnails "github.com/owncloud/ocis/thumbnails/pkg/config"
|
||||
web "github.com/owncloud/ocis/web/pkg/config"
|
||||
webdav "github.com/owncloud/ocis/webdav/pkg/config"
|
||||
)
|
||||
|
||||
// Log defines the available logging configuration.
|
||||
type Log struct {
|
||||
Level string
|
||||
Pretty bool
|
||||
Color bool
|
||||
}
|
||||
|
||||
// Debug defines the available debug configuration.
|
||||
type Debug struct {
|
||||
Addr string
|
||||
Token string
|
||||
Pprof bool
|
||||
Zpages bool
|
||||
}
|
||||
|
||||
// HTTP defines the available http configuration.
|
||||
type HTTP struct {
|
||||
Addr string
|
||||
Root string
|
||||
}
|
||||
|
||||
// GRPC defines the available grpc configuration.
|
||||
type GRPC struct {
|
||||
Addr string
|
||||
}
|
||||
|
||||
// Tracing defines the available tracing configuration.
|
||||
type Tracing struct {
|
||||
Enabled bool
|
||||
Type string
|
||||
Endpoint string
|
||||
Collector string
|
||||
Service string
|
||||
}
|
||||
|
||||
// TokenManager is the config for using the reva token manager
|
||||
type TokenManager struct {
|
||||
JWTSecret string
|
||||
}
|
||||
|
||||
// Config combines all available configuration parts.
|
||||
type Config struct {
|
||||
Registry string
|
||||
Log Log
|
||||
Debug Debug
|
||||
HTTP HTTP
|
||||
GRPC GRPC
|
||||
Tracing Tracing
|
||||
TokenManager TokenManager
|
||||
|
||||
Accounts *accounts.Config
|
||||
GLAuth *glauth.Config
|
||||
Graph *graph.Config
|
||||
GraphExplorer *graphExplorer.Config
|
||||
IDP *idp.Config
|
||||
OCS *ocs.Config
|
||||
Web *web.Config
|
||||
Proxy *proxy.Config
|
||||
Settings *settings.Config
|
||||
Storage *storage.Config
|
||||
Store *store.Config
|
||||
Thumbnails *thumbnails.Config
|
||||
WebDAV *webdav.Config
|
||||
Runtime *pman.Config
|
||||
}
|
||||
|
||||
// New initializes a new configuration with or without defaults.
|
||||
func New() *Config {
|
||||
return &Config{
|
||||
Accounts: accounts.New(),
|
||||
GLAuth: glauth.New(),
|
||||
Graph: graph.New(),
|
||||
GraphExplorer: graphExplorer.New(),
|
||||
IDP: idp.New(),
|
||||
OCS: ocs.New(),
|
||||
Web: web.New(),
|
||||
Proxy: proxy.New(),
|
||||
Settings: settings.New(),
|
||||
Storage: storage.New(),
|
||||
Store: store.New(),
|
||||
Thumbnails: thumbnails.New(),
|
||||
WebDAV: webdav.New(),
|
||||
Runtime: pman.NewConfig(),
|
||||
}
|
||||
}
|
||||
@@ -1,181 +0,0 @@
|
||||
package flagset
|
||||
|
||||
import (
|
||||
"github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
// RootWithConfig applies cfg to the root flagset
|
||||
func RootWithConfig(cfg *config.Config) []cli.Flag {
|
||||
return []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
// this is just a dummy config flag do document the existence
|
||||
// of this environment variable
|
||||
// the environment variable itself is used in `ocis-pkg/config/defaults/paths.go`
|
||||
Name: "ocis-base-data-path",
|
||||
Usage: "Set the base path where oCIS stores data",
|
||||
EnvVars: []string{"OCIS_BASE_DATA_PATH"},
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "config-file",
|
||||
Usage: "Load config file from a non standard location.",
|
||||
EnvVars: []string{"OCIS_CONFIG_FILE"},
|
||||
Destination: &cfg.File,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "ocis-log-level",
|
||||
Value: "info",
|
||||
Usage: "Set logging level",
|
||||
EnvVars: []string{"OCIS_LOG_LEVEL"},
|
||||
Destination: &cfg.Log.Level,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Value: false,
|
||||
Name: "ocis-log-pretty",
|
||||
Usage: "Enable pretty logging",
|
||||
EnvVars: []string{"OCIS_LOG_PRETTY"},
|
||||
Destination: &cfg.Log.Pretty,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Value: true,
|
||||
Name: "ocis-log-color",
|
||||
Usage: "Enable colored logging",
|
||||
EnvVars: []string{"OCIS_LOG_COLOR"},
|
||||
Destination: &cfg.Log.Color,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "ocis-log-file",
|
||||
Usage: "Enable log to file",
|
||||
EnvVars: []string{"OCIS_LOG_FILE"},
|
||||
Destination: &cfg.Log.File,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "tracing-enabled",
|
||||
Usage: "Enable sending traces",
|
||||
EnvVars: []string{"OCIS_TRACING_ENABLED"},
|
||||
Destination: &cfg.Tracing.Enabled,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "tracing-type",
|
||||
Value: "jaeger",
|
||||
Usage: "Tracing backend type",
|
||||
EnvVars: []string{"OCIS_TRACING_TYPE"},
|
||||
Destination: &cfg.Tracing.Type,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "tracing-endpoint",
|
||||
Value: "",
|
||||
Usage: "Endpoint for the agent",
|
||||
EnvVars: []string{"OCIS_TRACING_ENDPOINT"},
|
||||
Destination: &cfg.Tracing.Endpoint,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "tracing-collector",
|
||||
Value: "",
|
||||
Usage: "Endpoint for the collector",
|
||||
EnvVars: []string{"OCIS_TRACING_COLLECTOR"},
|
||||
Destination: &cfg.Tracing.Collector,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "tracing-service",
|
||||
Value: "ocis",
|
||||
Usage: "Service name for tracing",
|
||||
EnvVars: []string{"OCIS_TRACING_SERVICE"},
|
||||
Destination: &cfg.Tracing.Service,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "jwt-secret",
|
||||
Value: "Pive-Fumkiu4",
|
||||
Usage: "Used to dismantle the access token, should equal reva's jwt-secret",
|
||||
EnvVars: []string{"OCIS_JWT_SECRET"},
|
||||
Destination: &cfg.TokenManager.JWTSecret,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "runtime-port",
|
||||
Value: "9250",
|
||||
Usage: "Configures which port the runtime starts",
|
||||
EnvVars: []string{"OCIS_RUNTIME_PORT"},
|
||||
Destination: &cfg.Runtime.Port,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "runtime-host",
|
||||
Value: "localhost",
|
||||
Usage: "Configures the host where the runtime process is running",
|
||||
EnvVars: []string{"OCIS_RUNTIME_HOST"},
|
||||
Destination: &cfg.Runtime.Host,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// HealthWithConfig applies cfg to the root flagset
|
||||
func HealthWithConfig(cfg *config.Config) []cli.Flag {
|
||||
return []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "debug-addr",
|
||||
Value: "127.0.0.1:9010",
|
||||
Usage: "Address to debug endpoint",
|
||||
EnvVars: []string{"OCIS_DEBUG_ADDR"},
|
||||
Destination: &cfg.Debug.Addr,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// ServerWithConfig applies cfg to the root flagset
|
||||
func ServerWithConfig(cfg *config.Config) []cli.Flag {
|
||||
return []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "debug-addr",
|
||||
Value: "127.0.0.1:9010",
|
||||
Usage: "Address to bind debug server",
|
||||
EnvVars: []string{"OCIS_DEBUG_ADDR"},
|
||||
Destination: &cfg.Debug.Addr,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "debug-token",
|
||||
Value: "",
|
||||
Usage: "Token to grant metrics access",
|
||||
EnvVars: []string{"OCIS_DEBUG_TOKEN"},
|
||||
Destination: &cfg.Debug.Token,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "debug-pprof",
|
||||
Usage: "Enable pprof debugging",
|
||||
EnvVars: []string{"OCIS_DEBUG_PPROF"},
|
||||
Destination: &cfg.Debug.Pprof,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "debug-zpages",
|
||||
Usage: "Enable zpages debugging",
|
||||
EnvVars: []string{"OCIS_DEBUG_ZPAGES"},
|
||||
Destination: &cfg.Debug.Zpages,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "http-addr",
|
||||
Value: "127.0.0.1:9000",
|
||||
Usage: "Address to bind http server",
|
||||
EnvVars: []string{"OCIS_HTTP_ADDR"},
|
||||
Destination: &cfg.HTTP.Addr,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "http-root",
|
||||
Value: "/",
|
||||
Usage: "Root path of http server",
|
||||
EnvVars: []string{"OCIS_HTTP_ROOT"},
|
||||
Destination: &cfg.HTTP.Root,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "grpc-addr",
|
||||
Value: "127.0.0.1:9001",
|
||||
Usage: "Address to bind grpc server",
|
||||
EnvVars: []string{"OCIS_GRPC_ADDR"},
|
||||
Destination: &cfg.GRPC.Addr,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "extensions",
|
||||
Aliases: []string{"e"},
|
||||
Usage: "Run specific extensions during supervised mode",
|
||||
EnvVars: []string{"OCIS_RUN_EXTENSIONS"},
|
||||
Destination: &cfg.Runtime.Extensions,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,8 @@ import (
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/shared"
|
||||
|
||||
mzlog "github.com/asim/go-micro/plugins/logger/zerolog/v4"
|
||||
"github.com/mohae/deepcopy"
|
||||
"github.com/olekukonko/tablewriter"
|
||||
@@ -159,13 +161,22 @@ func Start(o ...Option) error {
|
||||
FailureBackoff: 3 * time.Second,
|
||||
})
|
||||
|
||||
// reva storages have their own logging. For consistency sake the top level logging will cascade to reva.
|
||||
s.cfg.Storage.Log.Color = s.cfg.Log.Color
|
||||
s.cfg.Storage.Log.Level = s.cfg.Log.Level
|
||||
s.cfg.Storage.Log.Pretty = s.cfg.Log.Pretty
|
||||
s.cfg.Storage.Log.File = s.cfg.Log.File
|
||||
if s.cfg.Commons == nil {
|
||||
s.cfg.Commons = &shared.Commons{
|
||||
Log: &shared.Log{},
|
||||
}
|
||||
}
|
||||
|
||||
if err := rpc.Register(s); err != nil {
|
||||
if s.cfg.Storage.Log == nil {
|
||||
s.cfg.Storage.Log = &shared.Log{}
|
||||
}
|
||||
|
||||
s.cfg.Storage.Log.Color = s.cfg.Commons.Color
|
||||
s.cfg.Storage.Log.Level = s.cfg.Commons.Level
|
||||
s.cfg.Storage.Log.Pretty = s.cfg.Commons.Pretty
|
||||
s.cfg.Storage.Log.File = s.cfg.Commons.File
|
||||
|
||||
if err = rpc.Register(s); err != nil {
|
||||
if s != nil {
|
||||
s.Log.Fatal().Err(err)
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
if err := command.Execute(config.New()); err != nil {
|
||||
if err := command.Execute(config.DefaultConfig()); err != nil {
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user