config

package
v1.54.1 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package config defines runtime configuration defaults.

Index

Constants

View Source
const (
	DefaultProvider          = "copilot"
	DefaultHTTPAddr          = "0.0.0.0:80"
	DefaultProjectsDir       = "~/projects"
	DefaultStateDir          = "~/.local/state/dev-cockpit"
	DefaultAuthUsername      = "admin"
	DefaultAuthPasswordHash  = "$2a$10$EcwjmJDytWtfOs4anrB/gu6A0Gryb9r43SvSwqMr/Y.bPbRPFeyW."
	DefaultSessionCookieName = "session"
	DefaultSessionCookieKey  = "ThisKeyIsNotSecret"
	DefaultTrustedProxies    = "127.0.0.1/8,::1/128"
	DefaultTLSCertFile       = ""
	DefaultTLSKeyFile        = ""
	DefaultMaxRequestBody    = 100 * 1024 * 1024
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Network
	HTTPAddr           string
	MaxRequestBodySize int64
	TrustedProxies     []string
	TLSCertFile        string
	TLSKeyFile         string

	// Authentication
	AuthUsername        string
	AuthPasswordHash    string
	AuthSessionCookie   string
	AuthSessionLifetime time.Duration
	AuthCookieKey       []byte

	// Login rate limiting (per client IP)
	LoginRateMaxAttempts int
	LoginRateWindow      time.Duration
	LoginRateBlock       time.Duration

	// Filesystem locations
	ProjectsRoot string
	StateDir     string

	// Terminal stream tuning
	StreamHeartbeatInterval time.Duration
	StreamMinFrameInterval  time.Duration
	TerminalHistoryLimit    int
	MinTerminalCols         int
	MinTerminalRows         int
	MaxTerminalCols         int
	MaxTerminalRows         int
	SnapshotCacheTTL        time.Duration
}

Config holds runtime settings.

func Load

func Load(opts Options) (Config, error)

Load applies sensible defaults and normalizes startup values.

type Options

type Options struct {
	HTTPAddr           string
	ProjectsDir        string
	StateDir           string
	AuthUsername       string
	AuthPasswordHash   string
	SessionCookieName  string
	SessionCookieKey   string
	TrustedProxies     string
	TLSCertFile        string
	TLSKeyFile         string
	MaxRequestBodySize int64
}

Options carries the raw startup flag values before normalization.

Jump to

Keyboard shortcuts

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