config

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	// Comma-separated emails that are automatically granted admin role
	// on first login. Env-only so an admin can't remove themselves from
	// the approver list via the UI.
	AdminEmails string `env:"APP_ADMIN_EMAILS" envDefault:"admin@admin.com"`
	// Default password used once to seed an admin account when the DB
	// has no admin user yet. Ignored on every subsequent boot.
	AdminPassword string `env:"APP_ADMIN_PASSWORD" envDefault:"admin"`
	// Fallback APP_NAME used only when the DB has no `app_name` row yet
	// (first boot). Once written to the DB, the DB value wins.
	Name string `env:"APP_NAME" envDefault:""`
	// Fallback APP_URL used only when the DB has no `app_url` row yet
	// (first boot). Once written to the DB, the DB value wins.
	URL string `env:"APP_URL" envDefault:"http://localhost:8080"`
	// HTTP listen port. CLI --port flag overrides this.
	Port int `env:"PORT" envDefault:"8080"`
}

App holds env-only values. Anything user-editable at runtime belongs in the `app_variables` table instead.

type Config

type Config struct {
	App      App
	Database Database
}

func Load

func Load() *Config

Load parses environment variables into Config. Every field has a sensible default so running the binary without a .env still boots. App-level runtime knobs (app_url, session_secret) and SSO credentials live in the database, not here — see internal/configs and internal/sso.

type ContextKey

type ContextKey int
const (
	RequestIDKey ContextKey = iota
)

type Database

type Database struct {
	URL string `env:"DATABASE_URL" envDefault:"wick.db"`
}

Jump to

Keyboard shortcuts

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