config

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package config provides configuration management for the LacyLights server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Server configuration
	Port string
	Env  string

	// Database configuration
	DatabaseURL string

	// DMX configuration
	DMXUniverseCount    int
	DMXRefreshRate      int           // Hz (active)
	DMXIdleRate         int           // Hz (idle)
	DMXHighRateDuration time.Duration // Duration to stay in high rate after changes

	// Fade engine configuration
	FadeUpdateRateHz int // Hz (default 60, for smooth 60fps fades)

	// Art-Net configuration
	ArtNetEnabled   bool
	ArtNetPort      int
	ArtNetBroadcast string

	// Timing monitoring
	DMXDriftThreshold int // Only warn for drifts > threshold (ms)
	DMXDriftThrottle  int // Throttle warnings (ms)

	// Non-interactive mode (for Docker/CI)
	NonInteractive bool

	// CORS configuration
	CORSOrigin   string
	CORSAllowAll bool // Allow all origins (for E2E testing only, not production)

	// OFL (Open Fixture Library) import configuration
	OFLImportEnabled bool   // Enable automatic OFL import on startup
	OFLCachePath     string // Path to cache downloaded OFL data

	// Authentication configuration
	AuthEnabled          bool          // Enable authentication (default: false for easy onboarding)
	JWTSecret            string        // Secret key for signing JWTs (auto-generated if empty)
	JWTIssuer            string        // JWT issuer claim
	JWTAccessTokenTTL    time.Duration // Access token lifetime (default: 15m)
	JWTRefreshTokenTTL   time.Duration // Refresh token lifetime (default: 7d)
	SessionDurationHours int           // Session duration in hours (default: 24)
	PasswordMinLength    int           // Minimum password length (default: 8)
	DeviceAuthEnabled    bool          // Enable device-based authentication
	DefaultAdminEmail    string        // Default admin email (for initial setup)
	DefaultAdminPassword string        // Default admin password (for initial setup)
	AppleClientID        string        // Apple Sign-In client ID (bundle ID)
	AppleTeamID          string        // Apple Sign-In team ID
	AppleKeyID           string        // Apple Sign-In key ID
	ApplePrivateKeyPath  string        // Path to Apple Sign-In private key (.p8)
}

Config holds all configuration values for the server.

func Load

func Load() *Config

Load loads configuration from environment variables with sensible defaults.

func (*Config) IsDevelopment

func (c *Config) IsDevelopment() bool

IsDevelopment returns true if running in development mode.

func (*Config) IsProduction

func (c *Config) IsProduction() bool

IsProduction returns true if running in production mode.

Jump to

Keyboard shortcuts

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