config

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrRequired = errors.New("required")

Functions

func FlagSet added in v1.0.0

func FlagSet() *flag.FlagSet

FlagSet configure the command line parser using flag library.

func StringToTemplateHookFunc added in v1.6.0

func StringToTemplateHookFunc() mapstructure.DecodeHookFuncType

StringToTemplateHookFunc parse a string to template.Template.

func StringToURLHookFunc added in v1.7.0

func StringToURLHookFunc() mapstructure.DecodeHookFuncType

StringToURLHookFunc parse a string to url.URL.

func Validate added in v1.0.0

func Validate(conf Config) error

Validate validates the config.

Types

type Config

type Config struct {
	ConfigFile string  `koanf:"config"`
	Log        Log     `koanf:"log"`
	HTTP       HTTP    `koanf:"http"`
	OpenVpn    OpenVpn `koanf:"openvpn"`
	OAuth2     OAuth2  `koanf:"oauth2"`
}

type HTTP added in v1.7.0

type HTTP struct {
	Listen             string             `koanf:"listen"`
	CertFile           string             `koanf:"cert"`
	KeyFile            string             `koanf:"key"`
	TLS                bool               `koanf:"tls"`
	BaseURL            *url.URL           `koanf:"baseurl"`
	Secret             string             `koanf:"secret"`
	CallbackTemplate   *template.Template `koanf:"callback-template-path"`
	Check              HTTPCheck          `koanf:"check"`
	EnableProxyHeaders bool               `koanf:"enable-proxy-headers"`
}

type HTTPCheck added in v1.7.0

type HTTPCheck struct {
	IPAddr bool `koanf:"ipaddr"`
}

type Log added in v1.0.0

type Log struct {
	Format string `koanf:"format"`
	Level  string `koanf:"level"`
}

type OAuth2 added in v1.0.0

type OAuth2 struct {
	Issuer          *url.URL        `koanf:"issuer"`
	Provider        string          `koanf:"provider"`
	AuthorizeParams string          `koanf:"authorize-params"`
	Endpoints       OAuth2Endpoints `koanf:"endpoint"`
	Client          OAuth2Client    `koanf:"client"`
	Scopes          []string        `koanf:"scopes"`
	Pkce            bool            `koanf:"pkce"`
	Validate        OAuth2Validate  `koanf:"validate"`
}

type OAuth2Client added in v1.0.0

type OAuth2Client struct {
	ID     string `koanf:"id"`
	Secret string `koanf:"secret"`
}

type OAuth2Endpoints added in v1.2.0

type OAuth2Endpoints struct {
	Discovery *url.URL `koanf:"discovery"`
	Auth      *url.URL `koanf:"auth"`
	Token     *url.URL `koanf:"token"`
}

type OAuth2Validate added in v1.0.0

type OAuth2Validate struct {
	Groups     []string `koanf:"groups"`
	Roles      []string `koanf:"roles"`
	IPAddr     bool     `koanf:"ipaddr"`
	Issuer     bool     `koanf:"issuer"`
	CommonName string   `koanf:"common_name"`
}

type OpenVpn added in v1.0.0

type OpenVpn struct {
	Addr          *url.URL      `koanf:"addr"`
	Password      string        `koanf:"password"`
	Bypass        OpenVpnBypass `koanf:"bypass"`
	AuthTokenUser bool          `koanf:"auth-token-user"`
}

type OpenVpnBypass added in v1.1.0

type OpenVpnBypass struct {
	CommonNames []string `koanf:"cn"`
}

Jump to

Keyboard shortcuts

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