config

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2026 License: GPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvConfigPath = "DASHBRR__CONFIG_PATH"
)

Variables

This section is empty.

Functions

func HasRequiredEnvVars

func HasRequiredEnvVars() bool

HasRequiredEnvVars checks if all required environment variables are set

func LoadEnvOverrides

func LoadEnvOverrides(config *Config) error

LoadEnvOverrides loads configuration from environment variables

Types

type AuthConfig

type AuthConfig struct {
	OIDC OIDCConfig `toml:"oidc"`
}

AuthConfig holds authentication-related configuration

type Config

type Config struct {
	Server   ServerConfig   `toml:"server"`
	Database DatabaseConfig `toml:"database"`
	Auth     AuthConfig     `toml:"auth"`
}

Config represents the main configuration structure

func DefaultConfig added in v0.3.0

func DefaultConfig() *Config

DefaultConfig returns a configuration with default values

func LoadConfig

func LoadConfig(path string) (*Config, error)

LoadConfig loads the configuration from environment variables or TOML file

type DatabaseConfig

type DatabaseConfig struct {
	Type     string `toml:"type" env:"DASHBRR__DB_TYPE"`
	Path     string `toml:"path" env:"DASHBRR__DB_PATH"`
	Host     string `toml:"host" env:"DASHBRR__DB_HOST"`
	Port     int    `toml:"port" env:"DASHBRR__DB_PORT"`
	User     string `toml:"user" env:"DASHBRR__DB_USER"`
	Password string `toml:"password" env:"DASHBRR__DB_PASSWORD"`
	Name     string `toml:"name" env:"DASHBRR__DB_NAME"`
}

DatabaseConfig holds database-related configuration

type OIDCConfig

type OIDCConfig struct {
	Issuer       string `toml:"issuer" env:"OIDC_ISSUER"`
	ClientID     string `toml:"client_id" env:"OIDC_CLIENT_ID"`
	ClientSecret string `toml:"client_secret" env:"OIDC_CLIENT_SECRET"`
	RedirectURL  string `toml:"redirect_url" env:"OIDC_REDIRECT_URL"`
}

OIDCConfig holds OIDC-specific configuration

type ServerConfig

type ServerConfig struct {
	ListenAddr  string   `toml:"listen_addr" env:"DASHBRR__LISTEN_ADDR"`
	CORSOrigins []string `toml:"cors_origins" env:"DASHBRR__CORS_ORIGINS"`
	CORSHeaders []string `toml:"cors_headers" env:"DASHBRR__CORS_HEADERS"`
	CORSMethods []string `toml:"cors_methods" env:"DASHBRR__CORS_METHODS"`
	CORSMaxAgeH int      `toml:"cors_max_age_hours" env:"DASHBRR__CORS_MAX_AGE_HOURS"`
	CORSCreds   *bool    `toml:"cors_allow_credentials" env:"DASHBRR__CORS_ALLOW_CREDENTIALS"`
}

ServerConfig holds server-related configuration

Jump to

Keyboard shortcuts

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