config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseMemory

func ParseMemory(s string) (int64, error)

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

	// Docker
	DockerHost     string
	ImageAllowlist []string

	// Execution limits
	DefaultTimeout     time.Duration
	MaxTimeout         time.Duration
	DefaultMemory      int64   // bytes
	DefaultCPU         float64 // Docker CPU quota (e.g. 0.5 = half a core)
	MaxOutputSize      int64   // bytes
	MaxSkillSize       int64   // bytes
	MaxConcurrentExecs int     // max parallel container 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

func Load() (*Config, error)

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.

Jump to

Keyboard shortcuts

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