config

package
v0.0.0-...-5c2e7a1 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2022 License: EUPL-1.2 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadConfig

func ReadConfig()

ReadConfig reads the configuration yaml file and overrides it with any set environment variables

Types

type Config

type Config struct {
	Server struct {
		Port  string `yaml:"port" envconfig:"SERVER_PORT"`
		Host  string `yaml:"host" envconfig:"SERVER_HOST"`
		IsDev bool   `yaml:"is_dev" envconfig:"IS_DEV"`
		DSN   string `yaml:"dsn" envconfig:"DB_DSN"`
	} `yaml:"server"`
	Frontend struct {
		Templates string `yaml:"templates" envconfig:"TEMPLATE_DIR"`
		Static    string `yaml:"static" envconfig:"STATIC_DIR"`
	}
	Cache struct {
		Repo struct {
			Base string `yaml:"base" envconfig:"REPO_CACHE_BASE"`
		} `yaml:"repo"`
		Book struct {
			Base string `yaml:"base" envconfig:"BOOK_CACHE_BASE"` // mdbook destination folder
		} `yaml:"book"`
		Plot struct {
			Base string `yaml:"base" envconfig:"PLOT_CACHE_BASE"` // edea diff destination folder
		} `yaml:"plot"`
	} `yaml:"cache"`
	Auth struct {
		OIDC struct {
			ProviderURL   string `yaml:"provider_url" envconfig:"AUTH_PROVIDER_URL"`
			ClientID      string `yaml:"client_id" envconfig:"AUTH_CLIENT_ID"`
			ClientSecret  string `yaml:"client_secret" envconfig:"AUTH_CLIENT_SECRET"`
			RedirectURL   string `yaml:"redirect_url" envconfig:"AUTH_REDIRECT_URL"`
			LogoutURL     string `yaml:"logout_url" envconfig:"AUTH_LOGOUT_URL"`
			PostLogoutURL string `yaml:"post_logout_url" envconfig:"AUTH_POST_LOGOUT_URL"`
		} `yaml:"oidc"`
		MiniOIDCServer struct {
			UseBuiltin     bool     `yaml:"use_builtin" envconfig:"MINIOIDC_START_SERVER"`
			PostLogoutURLs []string `yaml:"post_logout_urls" envconfig:"MINIOIDC_POST_LOGOUT_URLS"`
			RedirectURLs   []string `yaml:"redirect_urls" envconfig:"MINIOIDC_REDIRECT_URLS"`
			UsersFile      string   `yaml:"users" envconfig:"MINIOIDC_USERS"`
		} `yaml:"oidc_server"`
	} `yaml:"auth"`
	Search struct {
		Host   string `yaml:"host" envconfig:"SEARCH_HOST"`
		Index  string `yaml:"index" envconfig:"SEARCH_INDEX"`
		APIKey string `yaml:"api_key" envconfig:"SEARCH_API_KEY"`
	} `yaml:"search"`
}

Config holds all the keys which should be available in the conig.yml or as environment variables

var Cfg Config

Cfg global config state

Jump to

Keyboard shortcuts

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