config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: GPL-2.0 Imports: 4 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 CacheConfig

type CacheConfig struct {
	Type  string      `toml:"type" env:"CACHE_TYPE"`
	Redis RedisConfig `toml:"redis"`
}

CacheConfig holds cache-related configuration

type Config

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

Config represents the main configuration structure

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 RedisConfig

type RedisConfig struct {
	Host string `toml:"host" env:"REDIS_HOST"`
	Port int    `toml:"port" env:"REDIS_PORT"`
}

RedisConfig holds Redis-specific configuration

type ServerConfig

type ServerConfig struct {
	ListenAddr string `toml:"listen_addr" env:"DASHBRR__LISTEN_ADDR"`
}

ServerConfig holds server-related configuration

Jump to

Keyboard shortcuts

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