config

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthConfig

type AuthConfig struct {
	APIKeys []string `koanf:"api_keys"`
	Enabled bool     `koanf:"enabled"`
}

AuthConfig holds authentication settings.

type Config

type Config struct {
	Server   ServerConfig   `koanf:"server"`
	Runtime  RuntimeConfig  `koanf:"runtime"`
	Sandbox  SandboxConfig  `koanf:"sandbox"`
	Store    StoreConfig    `koanf:"store"`
	Auth     AuthConfig     `koanf:"auth"`
	Log      LogConfig      `koanf:"log"`
	S3       S3Config       `koanf:"s3"`
	Resource ResourceConfig `koanf:"resource"`
}

Config holds all configuration for the den server.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns a Config with sensible defaults.

func Load

func Load(path string) (*Config, error)

Load reads configuration from a YAML file and environment variables. Environment variables are prefixed with DEN_ and use __ as separator. For example: DEN_SERVER__PORT=9090

func (*Config) Validate

func (c *Config) Validate() error

Validate checks the config for obvious misconfigurations.

type LogConfig

type LogConfig struct {
	Level  string `koanf:"level"`  // "debug", "info", "warn", "error"
	Format string `koanf:"format"` // "text", "json"
}

LogConfig holds logging settings.

type ResourceConfig added in v0.0.6

type ResourceConfig struct {
	OvercommitRatio    float64       `koanf:"overcommit_ratio"`
	PressureThreshold  float64       `koanf:"pressure_threshold"`
	CriticalThreshold  float64       `koanf:"critical_threshold"`
	MonitorInterval    time.Duration `koanf:"monitor_interval"`
	EnableAutoThrottle bool          `koanf:"enable_auto_throttle"`
	MinMemoryFloor     int64         `koanf:"min_memory_floor"`
}

ResourceConfig holds shared resource management settings.

type RuntimeConfig

type RuntimeConfig struct {
	Backend    string `koanf:"backend"` // "docker"
	DockerHost string `koanf:"docker_host"`
	NetworkID  string `koanf:"network_id"`
}

RuntimeConfig holds runtime backend settings.

type S3Config

type S3Config struct {
	Endpoint  string `koanf:"endpoint"`
	Region    string `koanf:"region"`
	AccessKey string `koanf:"access_key"`
	SecretKey string `koanf:"secret_key"`
}

S3Config holds server-wide S3 defaults.

func (S3Config) String

func (c S3Config) String() string

String returns a safe representation of S3Config that masks the secret key.

type SandboxConfig

type SandboxConfig struct {
	DefaultImage         string         `koanf:"default_image"`
	DefaultTimeout       time.Duration  `koanf:"default_timeout"`
	MaxSandboxes         int            `koanf:"max_sandboxes"`
	DefaultCPU           int64          `koanf:"default_cpu"`    // NanoCPUs
	DefaultMemory        int64          `koanf:"default_memory"` // bytes
	DefaultPidLimit      int64          `koanf:"default_pid_limit"`
	WarmPoolSize         int            `koanf:"warm_pool_size"`
	AllowVolumes         bool           `koanf:"allow_volumes"`
	AllowSharedVolumes   bool           `koanf:"allow_shared_volumes"`
	AllowS3              bool           `koanf:"allow_s3"`
	AllowS3FUSE          bool           `koanf:"allow_s3_fuse"`
	AllowHostBinds       bool           `koanf:"allow_host_binds"`
	MaxVolumesPerSandbox int            `koanf:"max_volumes_per_sandbox"`
	DefaultTmpfs         []TmpfsDefault `koanf:"default_tmpfs"`
}

SandboxConfig holds default sandbox settings.

type ServerConfig

type ServerConfig struct {
	Host           string   `koanf:"host"`
	Port           int      `koanf:"port"`
	AllowedOrigins []string `koanf:"allowed_origins"`
	RateLimitRPS   float64  `koanf:"rate_limit_rps"`
	RateLimitBurst int      `koanf:"rate_limit_burst"`
	TLS            struct {
		Enabled  bool   `koanf:"enabled"`
		CertFile string `koanf:"cert_file"`
		KeyFile  string `koanf:"key_file"`
	} `koanf:"tls"`
}

ServerConfig holds HTTP server settings.

type StoreConfig

type StoreConfig struct {
	Path string `koanf:"path"`
}

StoreConfig holds state persistence settings.

type TmpfsDefault

type TmpfsDefault struct {
	Path string `koanf:"path"`
	Size string `koanf:"size"`
}

TmpfsDefault defines a default tmpfs mount.

Jump to

Keyboard shortcuts

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