config

package
v0.0.0-...-8a0222f Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2026 License: AGPL-3.0, GPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const VERSION = "26.15"

Variables

This section is empty.

Functions

This section is empty.

Types

type AutomationSchedulerConfig

type AutomationSchedulerConfig struct {
	Delay     time.Duration // Delay before scheduler starts (default: 30s)
	Interval  time.Duration // Polling interval (default: 10s)
	BatchSize int           // Contacts per batch (default: 50)
}

type BroadcastConfig

type BroadcastConfig struct {
	DefaultRateLimit int // Default rate limit per minute for broadcasts (0 means use service default)
}

type Config

type Config struct {
	Server              ServerConfig
	Database            DatabaseConfig
	Security            SecurityConfig
	Tracing             TracingConfig
	SMTP                SMTPConfig
	SMTPRelay           SMTPRelayConfig
	Demo                DemoConfig
	Broadcast           BroadcastConfig
	TaskScheduler       TaskSchedulerConfig
	AutomationScheduler AutomationSchedulerConfig
	Telemetry           bool
	CheckForUpdates     bool
	RootEmail           string
	Environment         string
	APIEndpoint         string
	WebhookEndpoint     string
	LogLevel            string
	Version             string
	IsInstalled         bool // NEW: Indicates if setup wizard has been completed

	// Track which values came from actual environment variables (not database, not generated)
	EnvValues EnvValues
}

func Load

func Load() (*Config, error)

Load loads the configuration with default options

func LoadWithOptions

func LoadWithOptions(opts LoadOptions) (*Config, error)

LoadWithOptions loads the configuration with the specified options

func (*Config) GetEnvValues

func (c *Config) GetEnvValues() (rootEmail, apiEndpoint, smtpHost, smtpUsername, smtpPassword, smtpFromEmail, smtpFromName string, smtpPort int, smtpUseTLS string, smtpRelayEnabled string, smtpRelayDomain, smtpRelayTLSCertBase64, smtpRelayTLSKeyBase64 string, smtpRelayPort int)

GetEnvValues returns configuration values that came from actual environment variables This is used by the setup service to determine which settings are already configured

func (*Config) IsDemo

func (c *Config) IsDemo() bool

func (*Config) IsDevelopment

func (c *Config) IsDevelopment() bool

IsDevelopment returns true if the environment is set to development

func (*Config) IsProduction

func (c *Config) IsProduction() bool

type DatabaseConfig

type DatabaseConfig struct {
	Host                  string
	Port                  int
	User                  string
	Password              string
	DBName                string
	Prefix                string
	SSLMode               string
	MaxConnections        int           // Total max connections across all databases
	MaxConnectionsPerDB   int           // Max connections per individual workspace database
	ConnectionMaxLifetime time.Duration // Maximum lifetime of a connection
	ConnectionMaxIdleTime time.Duration // Maximum idle time before closing
}

type DemoConfig

type DemoConfig struct {
	FileManagerEndpoint  string
	FileManagerBucket    string
	FileManagerAccessKey string
	FileManagerSecretKey string
}

type EnvValues

type EnvValues struct {
	RootEmail              string
	APIEndpoint            string
	SMTPHost               string
	SMTPPort               int
	SMTPUsername           string
	SMTPPassword           string
	SMTPFromEmail          string
	SMTPFromName           string
	SMTPUseTLS             string // "true", "false", or "" (empty = not set, defaults to true)
	SMTPRelayEnabled       string // "true", "false", or "" (empty = not set, allows setup wizard to configure)
	SMTPRelayDomain        string
	SMTPRelayPort          int
	SMTPRelayTLSCertBase64 string
	SMTPRelayTLSKeyBase64  string
}

EnvValues tracks configuration that came from actual environment variables

type LoadOptions

type LoadOptions struct {
	EnvFile string // Optional environment file to load (e.g., ".env", ".env.test")
}

LoadOptions contains options for loading configuration

type SMTPConfig

type SMTPConfig struct {
	Host      string
	Port      int
	Username  string
	Password  string
	FromEmail string
	FromName  string
	UseTLS    bool
}

type SMTPRelayConfig

type SMTPRelayConfig struct {
	Enabled       bool   // Enable SMTP relay server for receiving emails
	Port          int    // Port to listen on (default: 587)
	Host          string // Host to bind to (default: "0.0.0.0")
	Domain        string // Server domain name for SMTP greeting
	TLSCertBase64 string // Base64 encoded TLS certificate
	TLSKeyBase64  string // Base64 encoded TLS private key
}

type SSLConfig

type SSLConfig struct {
	Enabled  bool
	CertFile string
	KeyFile  string
}

type SecurityConfig

type SecurityConfig struct {
	// JWTSecret for token signing (derived from SecretKey)
	JWTSecret []byte

	// SecretKey for DB encryption AND JWT signing
	SecretKey string
}

type ServerConfig

type ServerConfig struct {
	Port int
	Host string
	SSL  SSLConfig
}

type SystemSettings

type SystemSettings struct {
	IsInstalled            bool
	RootEmail              string
	APIEndpoint            string
	SMTPHost               string
	SMTPPort               int
	SMTPUsername           string
	SMTPPassword           string
	SMTPFromEmail          string
	SMTPFromName           string
	SMTPUseTLS             bool
	TelemetryEnabled       bool
	CheckForUpdates        bool
	SMTPRelayEnabled       bool
	SMTPRelayDomain        string
	SMTPRelayPort          int
	SMTPRelayTLSCertBase64 string
	SMTPRelayTLSKeyBase64  string
}

SystemSettings holds configuration loaded from database

type TaskSchedulerConfig

type TaskSchedulerConfig struct {
	Enabled  bool          // Enable/disable internal scheduler
	Interval time.Duration // Tick interval (default: 20s)
	MaxTasks int           // Max tasks per execution (default: 100)
}

type TracingConfig

type TracingConfig struct {
	Enabled             bool
	ServiceName         string
	SamplingProbability float64

	// Trace exporter configuration
	TraceExporter string // "jaeger", "stackdriver", "zipkin", "azure", "datadog", "xray", "none"

	// Jaeger settings
	JaegerEndpoint string

	// Zipkin settings
	ZipkinEndpoint string

	// Stackdriver settings
	StackdriverProjectID string

	// Azure Monitor settings
	AzureInstrumentationKey string

	// Datadog settings
	DatadogAgentAddress string
	DatadogAPIKey       string

	// AWS X-Ray settings
	XRayRegion string

	// General agent endpoint (for exporters that support a common agent)
	AgentEndpoint string

	// Metrics exporter configuration
	MetricsExporter string // "prometheus", "stackdriver", "datadog", "none" or comma-separated list
	PrometheusPort  int
}

Jump to

Keyboard shortcuts

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