Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseMemory ¶
ParseMemory converts a human-readable memory string to bytes. Supported suffixes (case-insensitive):
Ki / K — kibibytes (1024) Mi / M — mebibytes (1024^2) Gi / G — gibibytes (1024^3)
A plain integer is treated as bytes.
Types ¶
type Config ¶
type Config struct {
// Database
DBDSN string
// Redis (optional — system degrades gracefully without it)
RedisURL string
// S3 / MinIO
S3Endpoint string
S3AccessKey string
S3SecretKey string
S3BucketSkills string
S3BucketExecs string
S3UseSSL bool
// OpenSandbox
OpenSandboxURL string
OpenSandboxAPIKey string
SandboxExpiration time.Duration
ImageAllowlist []string
// Execution limits
DefaultTimeout time.Duration
MaxTimeout time.Duration
DefaultMemory int64 // bytes
DefaultCPU float64 // fractional CPU (e.g. 0.5 = half a core)
MaxOutputSize int64 // bytes
MaxSkillSize int64 // bytes
MaxConcurrentExecs int // max parallel sandbox executions
// Server
APIPort string
// Observability
LogLevel string
}
Config holds all application configuration loaded from environment variables. It follows 12-factor methodology: configuration is strictly separated from code.
func Load ¶
Load reads configuration from environment variables, validates required fields, parses durations and resource limits, and returns a fully populated Config. An error is returned if any required variable is missing or a value cannot be parsed.
func (*Config) DefaultCPUStr ¶ added in v0.2.0
DefaultCPUStr returns the default CPU limit as a string suitable for passing to OpenSandbox (e.g. "500m" for 0.5 cores).
func (*Config) DefaultMemoryStr ¶ added in v0.2.0
DefaultMemoryStr returns the default memory limit as a Kubernetes-style string suitable for passing to OpenSandbox (e.g. "256Mi").