config

package
v0.0.0-...-533ea73 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingParameter                = errors.New("a mandatory parameter is missing")
	ErrDefaultCookieDomainInProduction = errors.New("the cookie domain shouldn't be 'localhost' in production")
	ErrDefaultAuthSecretInProduction   = errors.New("the session authentication secret should be changed to a random value in production")
	ErrWrongAuthSecretSize             = errors.New("the session authentication secret should have a size of 32 or 64 bytes")
	ErrWrongEncSecretSize              = errors.New("the session encryption secret should have a size of 16, 24 or 32 bytes")
	ErrWrongEncDBKey                   = errors.New("the database encryption key must have a size of 32 bytes")
	ErrWrongDBType                     = errors.New("the database backend must be a value from: sqlite, postgresql")
	ErrMissingSQLiteDatabase           = errors.New("you must specify the database file name, using the db-name parameter")
	ErrMissingDBServerHost             = errors.New("you must specify the database host, using the db-host parameter")
	ErrMissingDBServerDatabase         = errors.New("you must specify the database name, using the db-name parameter")
	ErrMissingDBServerUsername         = errors.New("you must specify the username to connect to the database, using the db-username parameter")
	ErrMissingDBServerPassword         = errors.New("you must specify the password to connect to the database, using the db-password parameter")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	IsProduction              bool   `mapstructure:"IS_PRODUCTION"`
	LogLevel                  string `mapstructure:"LOG_LEVEL"`
	OidcIssuer                string `mapstructure:"OIDC_ISSUER"`
	OidcClientID              string `mapstructure:"OIDC_CLIENT_ID"`
	OidcClientSecret          string `mapstructure:"OIDC_CLIENT_SECRET"`
	OidcRedirectURL           string `mapstructure:"OIDC_REDIRECT_URL"`
	OidcPostLoginRedirectURL  string `mapstructure:"OIDC_POST_LOGIN_REDIRECT_URL"`
	OidcPostLogoutRedirectURL string `mapstructure:"OIDC_POST_LOGOUT_REDIRECT_URL"`
	ListenAddr                string `mapstructure:"LISTEN_ADDR"`
	CookieDomain              string `mapstructure:"COOKIE_DOMAIN"`
	CookieName                string `mapstructure:"COOKIE_NAME"`
	SessionAuthSecret         string `mapstructure:"SESSION_AUTH_SECRET"`
	SessionEncSecret          string `mapstructure:"SESSION_ENC_SECRET"`
	SessionOldAuthSecret      string `mapstructure:"SESSION_OLD_AUTH_SECRET"`
	SessionOldEncSecret       string `mapstructure:"SESSION_OLD_ENC_SECRET"`
	SessionDBKey              string `mapstructure:"SESSION_DB_KEY"`
	SessionOldDBKey           string `mapstructure:"SESSION_OLD_DB_KEY"`
	ProxyConfig               string `mapstructure:"PROXY_CONFIG"`
	DBType                    string `mapstructure:"DB_TYPE"`
	DBHost                    string `mapstructure:"DB_HOST"`
	DBName                    string `mapstructure:"DB_NAME"`
	DBUsername                string `mapstructure:"DB_USERNAME"`
	DBPassword                string `mapstructure:"DB_PASSWORD"`
}

Config stores all then configuration of the application. The values are read by Viper from a configuration file or from environment variables.

func LoadConfig

func LoadConfig() (config Config, err error)

LoadConfig reads the configuration from a file or from environment variables.

func (Config) ReadProxyConfig

func (c Config) ReadProxyConfig() (ProxyConfigData, error)

type ProxyConfigData

type ProxyConfigData struct {
	Proxies []struct {
		Endpoint   string `yaml:"endpoint"`
		Target     string `yaml:"target"`
		Parameters struct {
			IdleConnTimeout time.Duration `yaml:"idle-conn-timeout"`
			MaxIdleConns    int           `yaml:"max-idle-conns"`
			DialKeepAlive   time.Duration `yaml:"keep-alive"`
			DialTimeout     time.Duration `yaml:"timeout"`
		} `yaml:"parameters"`
	} `yaml:"proxies"`
}

Jump to

Keyboard shortcuts

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