Documentation
¶
Overview ¶
Package config provides configuration management for the sandbox server.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Server ServerConfig `yaml:"server"`
Storage StorageConfig `yaml:"storage"`
Runtime RuntimeConfig `yaml:"runtime"`
Sandbox SandboxConfig `yaml:"sandbox"`
Logging LoggingConfig `yaml:"logging"`
}
Config represents the complete server configuration.
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns a configuration with sensible defaults.
func LoadOrDefault ¶
LoadOrDefault loads configuration from a file, or returns default if file doesn't exist.
type DockerRuntimeConfig ¶
type DockerRuntimeConfig struct {
Host string `yaml:"host"` // Docker daemon socket (default: uses DOCKER_HOST env or unix:///var/run/docker.sock)
DefaultImage string `yaml:"default_image"` // Default container image (default: "ubuntu:22.04")
NetworkMode string `yaml:"network_mode"` // Default network mode: "none", "bridge", "host" (default: "none")
EnableNetworking bool `yaml:"enable_networking"` // Allow network access in sandboxes (default: false)
}
DockerRuntimeConfig holds Docker runtime-specific configuration.
type LoggingConfig ¶
LoggingConfig holds logging configuration.
type RuntimeConfig ¶
type RuntimeConfig struct {
Type string `yaml:"type"` // "bwrap", "docker", "mock"
BwrapPath string `yaml:"bwrap_path"`
DefaultTimeout string `yaml:"default_timeout"`
MaxTimeout string `yaml:"max_timeout"`
Docker DockerRuntimeConfig `yaml:"docker"` // Docker-specific configuration
}
RuntimeConfig holds runtime configuration.
func (*RuntimeConfig) GetDefaultTimeout ¶
func (c *RuntimeConfig) GetDefaultTimeout() time.Duration
GetDefaultTimeout returns the default timeout as a time.Duration.
func (*RuntimeConfig) GetMaxTimeout ¶
func (c *RuntimeConfig) GetMaxTimeout() time.Duration
GetMaxTimeout returns the max timeout as a time.Duration.
type SandboxConfig ¶
type SandboxConfig struct {
DefaultExpiration string `yaml:"default_expiration"`
MaxPerUser int `yaml:"max_per_user"`
CleanupInterval string `yaml:"cleanup_interval"`
}
SandboxConfig holds sandbox defaults configuration.
func (*SandboxConfig) GetCleanupInterval ¶
func (c *SandboxConfig) GetCleanupInterval() time.Duration
GetCleanupInterval returns the cleanup interval as a time.Duration.
func (*SandboxConfig) GetDefaultExpiration ¶
func (c *SandboxConfig) GetDefaultExpiration() time.Duration
GetDefaultExpiration returns the default expiration as a time.Duration.
type ServerConfig ¶
ServerConfig holds server address configuration.
type StorageConfig ¶
type StorageConfig struct {
CodebasePath string `yaml:"codebase_path"`
MountPath string `yaml:"mount_path"`
DBPath string `yaml:"db_path"`
}
StorageConfig holds storage path configuration.