appconfig

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 6, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSecretEmpty      = errors.New("secret must be set")
	ErrHeaderNamesEmpty = errors.New("header-names must be set")
	ErrInvalidPath      = errors.New("path must not be empty and start with a /")
	ErrMultipleProvider = errors.New("do not setup multiple providers")
	ErrNoProvider       = errors.New("no provider set")
)

Functions

This section is empty.

Types

type AppConfig

type AppConfig struct {
	Config  func(s string) error `short:"c" long:"config" env:"CONFIG" description:"Path to appconfig file" json:"-"`
	EnvFile func(s string) error `short:"e" long:"env-file" description:"Path to env file" json:"-"`

	Log LogConfig `group:"Log Options" namespace:"log" env-namespace:"LOG"`

	Port     int    `long:"port" env:"PORT" default:"4181" description:"Port to listen on"`
	AuthHost string `long:"auth-host" env:"AUTH_HOST" description:"Single host to use when returning from 3rd party auth"`

	HeaderNames []string `` /* 153-byte string literal not displayed */
	UrlPath     string   `long:"url-path" env:"URL_PATH" default:"/_oauth" description:"Callback URL Path"`
	UserPath    string   `` /* 142-byte string literal not displayed */

	Cookie    CookieConfig    `group:"Cookie Options" namespace:"cookie" env-namespace:"COOKIE"`
	Whitelist WhitelistConfig `group:"Whitelist Options" namespace:"whitelist" env-namespace:"WHITELIST"`

	Providers provider.Providers `group:"providers" namespace:"providers" env-namespace:"PROVIDERS"`

	SelectedProvider provider.Provider
}

AppConfig holds the runtime application appconfig

func NewConfig

func NewConfig(args []string) (*AppConfig, error)

NewConfig parses and validates provided configuration into a appconfig object

func NewDefaultConfig

func NewDefaultConfig() (*AppConfig, error)

NewDefaultConfig creates a new global appconfig, parsed from command arguments

func (AppConfig) String

func (config AppConfig) String() string

func (*AppConfig) Validate

func (config *AppConfig) Validate() error

type CookieConfig

type CookieConfig struct {
	Secret     string              `long:"secret" env:"SECRET" description:"Secret used for signing (required)" json:"-"`
	SecretFile string              `long:"secret-file" env:"SECRET_FILE" description:"Path to a file containing the cookie secret"`
	Domains    types.CookieDomains `` /* 133-byte string literal not displayed */
	Insecure   bool                `long:"insecure" env:"INSECURE" description:"Use insecure cookies"`
	Name       string              `long:"name" env:"NAME" default:"_forward_auth" description:"Cookie Name"`
	CSRFName   string              `long:"csrf-name" env:"CSRF_NAME" default:"_forward_auth_csrf" description:"CSRF Cookie Name"`
	Lifetime   time.Duration       `` /* 131-byte string literal not displayed */
}

type LogConfig

type LogConfig struct {
	Verbose bool            `short:"v" long:"verbose" env:"VERBOSE" description:"Short hand for log level debug. Will override any setting for level"`
	Level   types.LogLevel  `` /* 131-byte string literal not displayed */
	Format  types.LogFormat `short:"f" long:"format" env:"FORMAT" default:"text" choice:"text" choice:"json" choice:"pretty" description:"Log format"`
}

type WhitelistConfig

type WhitelistConfig struct {
	Domains []string `` /* 143-byte string literal not displayed */
	Users   []string `` /* 131-byte string literal not displayed */
	// defaults to false
	MatchUserOrDomain bool `` /* 212-byte string literal not displayed */

	Networks types.Networks `` /* 194-byte string literal not displayed */
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL