config

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvDevelopment = "development"
	EnvTest        = "test"
	EnvProduction  = "production"
)

Environment constants (public)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Domain              string       // Base domain (e.g. "example.com")
	Port                string       // HTTP server port
	DBDir               string       // Directory for the SQLite database file
	AttachmentsDir      string       // Directory for attachment file storage
	URL                 string       // API base URL (https://api.{domain})
	SiteURL             string       // Site base URL (https://{domain})
	PrivateBeta         bool         // Enable private beta mode
	BootstrapAdminEmail string       // Optional bootstrap admin identity promoted after OTP verification
	Env                 string       // Environment (dev, staging, prod)
	ProxySubnet         netip.Prefix // CIDR of the trusted reverse proxy (zero value = no proxy)
	IPHashSalt          string       // Secret salt for hashing client IPs (required in production)
	VAPIDPublicKey      string       // VAPID public key used for Web Push
	VAPIDPrivateKey     string       // VAPID private key used for Web Push
	CookieDomain        string       // Domain attribute for session cookies (e.g. ".example.com")
	AllowedOrigins      []string     // CORS allowed origins
	Mailer              *Mailer      // Mailer configuration
	VAPIDSubject        string       // VAPID subject (https://{domain}) per RFC 8292
	RequestIDHeader     string       // HTTP header name for request ID propagation (default: X-Request-ID)
	HiveURL             string       // Base URL of the Hive PWA (https://hive.{domain})
	PushURL             string       // Base URL of the push endpoint (https://push.{domain})
	HookURL             string       // Base URL of the webhook endpoint (https://hook.{domain})
	SentryDSN           string       // Sentry/GlitchTip DSN (empty = disabled)
}

Config holds the application configuration loaded from environment variables.

func Load

func Load() (*Config, error)

Load reads the .env file (if present) and loads configuration from environment variables. Returns a Config struct with sensible defaults if variables are not set.

type Mailer

type Mailer struct {
	SMTPAddress  string // SMTP server address (host:port)
	SMTPUser     string // SMTP username
	SMTPPassword string // SMTP password
	ResendAPIKey string // Resend API key
	Sender       string // Email sender address
	ReplyTo      string // Reply-To address
	SiteURL      string // Site base URL for email links
}

Mailer holds mailer configuration.

Jump to

Keyboard shortcuts

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