config

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Mysql    DatabaseType = "mysql"
	Inmemory DatabaseType = "inmemory"

	Plain LogStyle = "plain"
	ECS   LogStyle = "ecs" // default
)

Variables

This section is empty.

Functions

func OidcKeySet

func OidcKeySet() []*rsa.PublicKey

func Validate

func Validate(conf *Application, logFunc func(format string, v ...interface{})) error

Types

type Application

type Application struct {
	Service  ServiceConfig  `yaml:"service"`
	Server   ServerConfig   `yaml:"server"`
	Database DatabaseConfig `yaml:"database"`
	Security SecurityConfig `yaml:"security"`
	Logging  LoggingConfig  `yaml:"logging"`
}

Application is the root configuration type that holds all other subconfiguration types

func GetApplicationConfig

func GetApplicationConfig() (*Application, error)

func UnmarshalFromYamlConfiguration

func UnmarshalFromYamlConfiguration(file io.Reader) (*Application, error)

UnmarshalFromYamlConfiguration decodes yaml data from an `io.Reader` interface.

type CorsConfig

type CorsConfig struct {
	DisableCors bool   `yaml:"disable"`
	AllowOrigin string `yaml:"allow_origin"`
}

type DatabaseConfig

type DatabaseConfig struct {
	Use        DatabaseType `yaml:"use"`
	Username   string       `yaml:"username"`
	Password   string       `yaml:"password"`
	Database   string       `yaml:"database"`
	Parameters []string     `yaml:"parameters"`
}

DatabaseConfig configures which db to use (mysql, inmemory) and how to connect to it (needed for mysql only)

type DatabaseType

type DatabaseType string

type FixedTokenConfig

type FixedTokenConfig struct {
	Api string `yaml:"api"` // shared-secret for server-to-server backend authentication
}

type LogStyle

type LogStyle string

type LoggingConfig

type LoggingConfig struct {
	Style    LogStyle `yaml:"style"`
	Severity string   `yaml:"severity"`
}

LoggingConfig configures logging

type OpenIdConnectConfig

type OpenIdConnectConfig struct {
	IdTokenCookieName     string   `yaml:"id_token_cookie_name"`     // optional, but must both be set, then tokens are read from cookies
	AccessTokenCookieName string   `yaml:"access_token_cookie_name"` // optional, but must both be set, then tokens are read from cookies
	TokenPublicKeysPEM    []string `yaml:"token_public_keys_PEM"`    // a list of public RSA keys in PEM format, see https://github.com/Jumpy-Squirrel/jwks2pem for obtaining PEM from openid keyset endpoint
	AdminGroup            string   `yaml:"admin_group"`              // the group claim that supplies admin rights
	AuthService           string   `yaml:"auth_service"`             // base url, usually http://localhost:nnnn, will skip userinfo checks if unset
	Audience              string   `yaml:"audience"`
	Issuer                string   `yaml:"issuer"`
}

type SecurityConfig

type SecurityConfig struct {
	Fixed        FixedTokenConfig    `yaml:"fixed_token"`
	Oidc         OpenIdConnectConfig `yaml:"oidc"`
	Cors         CorsConfig          `yaml:"cors"`
	RequireLogin bool                `yaml:"require_login_for_reg"`
}

SecurityConfig configures everything related to security

type ServerConfig

type ServerConfig struct {
	BaseAddress  string `yaml:"address"`
	Port         int    `yaml:"port"`
	ReadTimeout  int    `yaml:"read_timeout_seconds"`
	WriteTimeout int    `yaml:"write_timeout_seconds"`
	IdleTimeout  int    `yaml:"idle_timeout_seconds"`
}

ServerConfig contains all values for http releated configuration

type ServiceConfig

type ServiceConfig struct {
	Name                  string            `yaml:"name"`
	AttendeeService       string            `yaml:"attendee_service"`
	ProviderAdapter       string            `yaml:"provider_adapter"`
	TransactionIDPrefix   string            `yaml:"transaction_id_prefix"`
	AllowedCurrencies     []string          `yaml:"allowed_currencies"`
	DefaultPaymentComment map[string]string `yaml:"payment_default_comment"`
	PublicSepaLinkURL     string            `yaml:"public_sepa_link_url"`
}

ServiceConfig contains configuration values for service related tasks. E.g. URL to payment provider adapter

Jump to

Keyboard shortcuts

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