config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 10, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyEnvOverrides

func ApplyEnvOverrides(server *ServerConfig, database *DatabaseConfig, tailscale *TailscaleConfig, prefix string)

ApplyEnvOverrides applies environment variable overrides using the given prefix. For example, with prefix "MYAPP", it checks MYAPP_SERVER_HOST, MYAPP_DB_HOST, etc.

func Load

func Load[T any](path string, target *T) error

Load reads a YAML file and unmarshals it into the target struct.

Types

type DatabaseConfig

type DatabaseConfig struct {
	Host    string `yaml:"host"`
	Port    int    `yaml:"port"`
	Name    string `yaml:"name"`
	User    string `yaml:"user"`
	SSLMode string `yaml:"sslmode"`
}

func (DatabaseConfig) DSN

func (d DatabaseConfig) DSN(password string) string

func (DatabaseConfig) Validate

func (d DatabaseConfig) Validate() error

type SecretBackendConfig

type SecretBackendConfig struct {
	Type     string `yaml:"type"`      // "setec" or ""
	SetecURL string `yaml:"setec_url"` // e.g. "https://setec.tail-scale.ts.net"
}

type ServerConfig

type ServerConfig struct {
	Host string `yaml:"host"`
	Port int    `yaml:"port"`
}

type TailscaleConfig

type TailscaleConfig struct {
	Enabled  bool   `yaml:"enabled"`
	Hostname string `yaml:"hostname"`
	StateDir string `yaml:"state_dir"`
}

Jump to

Keyboard shortcuts

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