config

package
v0.0.0-...-2c9f6af Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package config loads the manager's runtime configuration via viper. Mirrors the server's config-loading style (file + env overrides).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdminConfig

type AdminConfig struct {
	Bootstrap BootstrapAdmin
}

type BootstrapAdmin

type BootstrapAdmin struct {
	Username string
	Password string
}

type CORSConfig

type CORSConfig struct {
	AllowedOrigins []string
}

type Config

type Config struct {
	Server ServerConfig
	DB     DBConfig
	JWT    JWTConfig
	Admin  AdminConfig
	Log    LogConfig
	CORS   CORSConfig
}

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the hardcoded default runtime configuration. The DB-backed (hot-reloadable) sections — jwt TTLs, log, cors, and the server read/write timeouts — use these as their seed/default values in the database and are NOT overridden by config.yml file values at runtime. server.port, db.*, jwt.secret and admin.bootstrap are NOT migrated to the database: server.port/db are startup/infra config sourced from config.yml / env (db must exist before the DB can be read; port requires a listener rebind i.e. a restart, so it is not hot-reloadable; secret stays out of the DB by convention).

func Load

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

Load reads the config file (path, or ./config.yml by default) and applies env overrides. Missing config file is acceptable — defaults/env apply.

Note: server.port, db.*, jwt.secret and admin.bootstrap.* are sourced from this file (startup/infra config). The jwt-ttl/log/cors/server-timeout sections are seeded into the database and managed there at runtime; values present in config.yml for those sections are ignored.

type DBConfig

type DBConfig struct {
	Dialect      string // "sqlite" | "postgres"
	DSN          string
	MaxOpenConns int
	MaxIdleConns int
}

type JWTConfig

type JWTConfig struct {
	Secret         string
	AccessTTLSecs  int
	RefreshTTLSecs int
}

type LogConfig

type LogConfig struct {
	Level  string
	Format string
}

type ServerConfig

type ServerConfig struct {
	Port             int
	ReadTimeoutSecs  int
	WriteTimeoutSecs int
}

Jump to

Keyboard shortcuts

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