Documentation
¶
Overview ¶
Package config loads bootstrap settings (needed before the database opens) from a YAML file overlaid by SHELLCN_* environment variables. Settings an admin edits at runtime live in the store, not here.
Package config provides typed application configuration.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AIConfig ¶
type AIConfig struct {
Kind string `mapstructure:"kind"`
Name string `mapstructure:"name"`
BaseURL string `mapstructure:"base_url"`
APIKey string `mapstructure:"api_key"`
Model string `mapstructure:"model"`
}
AIConfig is the optional operator-provided shared AI configuration. It is loaded from config.yaml + SHELLCN_AI_* env and exposed to clients only as a non-secret status projection.
func (AIConfig) Configured ¶
Configured reports whether a usable shared AI provider is present.
func (AIConfig) DisplayName ¶
DisplayName is the name shown to users, falling back to the kind.
type AuditConfig ¶
type AuditConfig struct {
Enabled bool `mapstructure:"enabled"`
RetentionDays int `mapstructure:"retention_days"` // 0 = disabled (keep forever)
CleanupInterval string `mapstructure:"cleanup_interval"` // how often to sweep expired audit rows
}
AuditConfig controls audit writes and optional retention cleanup. Audit is enabled by default; retention is OFF by default (RetentionDays == 0 keeps audit entries forever).
func (AuditConfig) CleanupEvery ¶
func (c AuditConfig) CleanupEvery() time.Duration
CleanupEvery parses CleanupInterval, falling back to a sane default.
func (AuditConfig) RetentionEnabled ¶
func (c AuditConfig) RetentionEnabled() bool
RetentionEnabled reports whether audit expiry/cleanup is active.
type AuthConfig ¶
type AuthConfig struct {
SessionTTL string `mapstructure:"session_ttl"`
JWTSecret string `mapstructure:"jwt_secret"`
}
func (AuthConfig) JWTSigningKey ¶
func (c AuthConfig) JWTSigningKey(masterKey []byte) []byte
JWTSigningKey returns a stable HMAC key. An explicit jwt_secret takes precedence; otherwise the key is derived from the already-required master key.
func (AuthConfig) SessionTTLDuration ¶
func (c AuthConfig) SessionTTLDuration() time.Duration
SessionTTLDuration parses SessionTTL, falling back to 24 hours.
type BootstrapConfig ¶
type Config ¶
type Config struct {
Server ServerConfig `mapstructure:"server"`
Auth AuthConfig `mapstructure:"auth"`
Bootstrap BootstrapConfig `mapstructure:"bootstrap"`
Database DatabaseConfig `mapstructure:"database"`
Secrets SecretsConfig `mapstructure:"secrets"`
Email EmailConfig `mapstructure:"email"`
Audit AuditConfig `mapstructure:"audit"`
Recordings RecordingsConfig `mapstructure:"recordings"`
AI AIConfig `mapstructure:"ai"`
}
type DatabaseConfig ¶
type EmailConfig ¶
type EmailConfig struct {
Enabled bool `mapstructure:"enabled"`
Host string `mapstructure:"host"`
Port int `mapstructure:"port"`
From string `mapstructure:"from"`
Username string `mapstructure:"username"`
Password string `mapstructure:"password"`
UseTLS bool `mapstructure:"use_tls"` // implicit TLS (e.g. port 465); else STARTTLS
}
EmailConfig is the outbound SMTP configuration used for account invitations. Disabled by default; when off, invites are shared via their copyable link.
type RecordingsConfig ¶
type RecordingsConfig struct {
Dir string `mapstructure:"dir"` // blob storage root directory
RetentionDays int `mapstructure:"retention_days"` // 0 = disabled (keep forever)
CleanupInterval string `mapstructure:"cleanup_interval"` // how often to sweep expired recordings
MaxChunkBytes int64 `mapstructure:"max_chunk_bytes"` // per-chunk cap for desktop uploads
}
RecordingsConfig controls session-recording storage and retention. Retention is OFF by default (RetentionDays == 0 keeps recordings forever); an admin opts in by setting a positive retention here. The cleanup job only runs when retention is enabled.
func (RecordingsConfig) CleanupEvery ¶
func (c RecordingsConfig) CleanupEvery() time.Duration
CleanupEvery parses CleanupInterval, falling back to a sane default.
func (RecordingsConfig) RetentionEnabled ¶
func (c RecordingsConfig) RetentionEnabled() bool
RetentionEnabled reports whether expiry/cleanup is active.