config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDefaultConfigPaths added in v0.0.6

func GetDefaultConfigPaths() []string

GetDefaultConfigPaths returns the default config file paths to search. Returns paths in order of precedence (first found wins).

Types

type ACMEConfig added in v0.0.6

type ACMEConfig struct {
	Email                 string `koanf:"email"`
	DNSProvider           string `koanf:"dns_provider"`
	CA                    string `koanf:"ca"`
	DNSPropagationTimeout string `koanf:"dns_propagation_timeout"`
	DNSResolvers          string `koanf:"dns_resolvers"`
	AllowedDomains        string `koanf:"allowed_domains"`
	CloudflareAPIToken    string `koanf:"cloudflare_api_token"`
}

ACMEConfig holds ACME / TLS certificate settings.

type APIConfig added in v0.0.6

type APIConfig struct {
	Hostname     string `koanf:"hostname"`
	TLS          bool   `koanf:"tls"`
	RedirectHTTP bool   `koanf:"redirect_http"`
}

APIConfig holds API ingress settings (exposes Hypeman API via Caddy).

type BuildConfig added in v0.0.6

type BuildConfig struct {
	MaxConcurrentSourceBuilds int    `koanf:"max_concurrent_source_builds"`
	BuilderImage              string `koanf:"builder_image"`
	Timeout                   int    `koanf:"timeout"`
	SecretsDir                string `koanf:"secrets_dir"`
	DockerSocket              string `koanf:"docker_socket"`
}

BuildConfig holds source-to-image build system settings.

type CaddyConfig added in v0.0.6

type CaddyConfig struct {
	ListenAddress   string `koanf:"listen_address"`
	AdminAddress    string `koanf:"admin_address"`
	AdminPort       int    `koanf:"admin_port"`
	InternalDNSPort int    `koanf:"internal_dns_port"`
	StopOnShutdown  bool   `koanf:"stop_on_shutdown"`
}

CaddyConfig holds Caddy reverse-proxy / ingress settings.

type CapacityConfig added in v0.0.6

type CapacityConfig struct {
	Disk    string `koanf:"disk"`
	Network string `koanf:"network"`
	DiskIO  string `koanf:"disk_io"`
}

CapacityConfig holds hard resource capacity limits (empty = auto-detect from host).

type Config

type Config struct {
	Port      string `koanf:"port"`
	DataDir   string `koanf:"data_dir"`
	JwtSecret string `koanf:"jwt_secret"`
	Env       string `koanf:"env"`
	Version   string `koanf:"version"`

	Network          NetworkConfig          `koanf:"network"`
	Caddy            CaddyConfig            `koanf:"caddy"`
	ACME             ACMEConfig             `koanf:"acme"`
	API              APIConfig              `koanf:"api"`
	Metrics          MetricsConfig          `koanf:"metrics"`
	Otel             OtelConfig             `koanf:"otel"`
	Logging          LoggingConfig          `koanf:"logging"`
	Images           ImagesConfig           `koanf:"images"`
	Build            BuildConfig            `koanf:"build"`
	Instances        InstancesConfig        `koanf:"instances"`
	Registry         RegistryConfig         `koanf:"registry"`
	Limits           LimitsConfig           `koanf:"limits"`
	Oversubscription OversubscriptionConfig `koanf:"oversubscription"`
	Capacity         CapacityConfig         `koanf:"capacity"`
	Hypervisor       HypervisorConfig       `koanf:"hypervisor"`
	Snapshot         SnapshotConfig         `koanf:"snapshot"`
	GPU              GPUConfig              `koanf:"gpu"`
}

Config is the top-level Hypeman server configuration.

func Load

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

Load loads configuration with the following precedence (highest to lowest):

  1. Environment variables — uses double-underscore (__) as the nesting separator: PORT, DATA_DIR, JWT_SECRET for top-level keys and CADDY__LISTEN_ADDRESS, NETWORK__BRIDGE_NAME, etc. for nested keys.
  2. YAML config file (if found)
  3. Default values

The configPath parameter specifies an explicit config file path. If empty, searches default locations based on OS. Returns an error if an explicitly provided configPath cannot be loaded.

func (*Config) Validate

func (c *Config) Validate() error

Validate checks configuration values for correctness. Returns an error if any configuration value is invalid.

type FirecrackerUFFDGraduationConfig added in v0.2.0

type FirecrackerUFFDGraduationConfig struct {
	Enabled           bool   `koanf:"enabled"`
	MinSessionAge     string `koanf:"min_session_age"`
	MaxConcurrent     int    `koanf:"max_concurrent"`
	ScanInterval      string `koanf:"scan_interval"`
	CompletionTimeout string `koanf:"completion_timeout"`
}

FirecrackerUFFDGraduationConfig controls the background controller that detaches running UFFD-backed VMs from their snapshot memory pager once they have soaked, so long-lived VMs stop depending on a pager and old pager versions retire. Disabled by default and only active on the uffd backend.

type GPUConfig added in v0.0.6

type GPUConfig struct {
	ProfileCacheTTL string `koanf:"profile_cache_ttl"`
}

GPUConfig holds GPU-related settings.

type HypervisorActiveBallooningConfig added in v0.1.0

type HypervisorActiveBallooningConfig struct {
	Enabled                               bool   `koanf:"enabled"`
	PollInterval                          string `koanf:"poll_interval"`
	PressureHighWatermarkAvailablePercent int    `koanf:"pressure_high_watermark_available_percent"`
	PressureLowWatermarkAvailablePercent  int    `koanf:"pressure_low_watermark_available_percent"`
	ProtectedFloorPercent                 int    `koanf:"protected_floor_percent"`
	ProtectedFloorMinBytes                string `koanf:"protected_floor_min_bytes"`
	MinAdjustmentBytes                    string `koanf:"min_adjustment_bytes"`
	PerVmMaxStepBytes                     string `koanf:"per_vm_max_step_bytes"`
	PerVmCooldown                         string `koanf:"per_vm_cooldown"`
}

HypervisorActiveBallooningConfig holds runtime host-driven reclaim settings.

type HypervisorConfig added in v0.0.6

type HypervisorConfig struct {
	Default                          string                          `koanf:"default"`
	CloudHypervisorDefaultVersion    string                          `koanf:"cloud_hypervisor_default_version"`
	FirecrackerBinaryPath            string                          `koanf:"firecracker_binary_path"`
	FirecrackerSnapshotMemoryBackend string                          `koanf:"firecracker_snapshot_memory_backend"`
	FirecrackerUFFDCacheMaxBytes     string                          `koanf:"firecracker_uffd_cache_max_bytes"`
	FirecrackerMaxConcurrentRestores int                             `koanf:"firecracker_max_concurrent_restores"`
	FirecrackerUFFDGraduation        FirecrackerUFFDGraduationConfig `koanf:"firecracker_uffd_graduation"`
	Memory                           HypervisorMemoryConfig          `koanf:"memory"`
}

HypervisorConfig holds hypervisor settings.

type HypervisorMemoryConfig added in v0.1.0

type HypervisorMemoryConfig struct {
	Enabled            bool                             `koanf:"enabled"`
	KernelPageInitMode string                           `koanf:"kernel_page_init_mode"`
	ReclaimEnabled     bool                             `koanf:"reclaim_enabled"`
	VZBalloonRequired  bool                             `koanf:"vz_balloon_required"`
	ActiveBallooning   HypervisorActiveBallooningConfig `koanf:"active_ballooning"`
}

HypervisorMemoryConfig holds guest memory management settings.

type ImagesAutoDeleteConfig added in v0.1.0

type ImagesAutoDeleteConfig struct {
	Enabled   bool     `koanf:"enabled"`
	UnusedFor string   `koanf:"unused_for"`
	Allowed   []string `koanf:"allowed"`
}

ImagesAutoDeleteConfig holds server-wide image retention settings.

type ImagesConfig added in v0.1.0

type ImagesConfig struct {
	AutoDelete ImagesAutoDeleteConfig `koanf:"auto_delete"`
	OCICacheGC OCICacheGCConfig       `koanf:"oci_cache_gc"`
}

ImagesConfig holds image-management settings.

type InstancesConfig added in v0.1.0

type InstancesConfig struct {
	LifecycleEventBufferSize int `koanf:"lifecycle_event_buffer_size"`
}

InstancesConfig holds instance-manager internal settings.

type LimitsConfig added in v0.0.6

type LimitsConfig struct {
	MaxVcpusPerInstance   int     `koanf:"max_vcpus_per_instance"`
	MaxMemoryPerInstance  string  `koanf:"max_memory_per_instance"`
	MaxTotalVolumeStorage string  `koanf:"max_total_volume_storage"`
	MaxConcurrentBuilds   int     `koanf:"max_concurrent_builds"`
	MaxOverlaySize        string  `koanf:"max_overlay_size"`
	MaxImageStorage       float64 `koanf:"max_image_storage"`
}

LimitsConfig holds per-instance and aggregate resource limits.

type LoggingConfig added in v0.0.6

type LoggingConfig struct {
	Level          string `koanf:"level"`
	MaxSize        string `koanf:"max_size"`
	MaxFiles       int    `koanf:"max_files"`
	RotateInterval string `koanf:"rotate_interval"`
}

LoggingConfig holds log rotation and level settings.

type MetricsConfig added in v0.1.0

type MetricsConfig struct {
	ListenAddress               string `koanf:"listen_address"`
	Port                        int    `koanf:"port"`
	VMLabelBudget               int    `koanf:"vm_label_budget"`
	ResourceRefreshInterval     string `koanf:"resource_refresh_interval"`
	AllocationReconcileInterval string `koanf:"allocation_reconcile_interval"`
}

MetricsConfig holds metrics endpoint settings.

type NetworkConfig added in v0.0.6

type NetworkConfig struct {
	BridgeName              string `koanf:"bridge_name"`
	SubnetCIDR              string `koanf:"subnet_cidr"`
	SubnetGateway           string `koanf:"subnet_gateway"`
	UplinkInterface         string `koanf:"uplink_interface"`
	DNSServer               string `koanf:"dns_server"`
	UploadBurstMultiplier   int    `koanf:"upload_burst_multiplier"`
	DownloadBurstMultiplier int    `koanf:"download_burst_multiplier"`
}

NetworkConfig holds network bridge and interface settings.

type OCICacheGCConfig added in v0.1.0

type OCICacheGCConfig struct {
	Enabled    bool   `koanf:"enabled"`
	Interval   string `koanf:"interval"`
	MinBlobAge string `koanf:"min_blob_age"`
}

OCICacheGCConfig holds settings for the OCI blob cache garbage collector.

type OtelConfig added in v0.0.6

type OtelConfig struct {
	Enabled                  bool    `koanf:"enabled"`
	Endpoint                 string  `koanf:"endpoint"`
	ServiceName              string  `koanf:"service_name"`
	ServiceInstanceID        string  `koanf:"service_instance_id"`
	Insecure                 bool    `koanf:"insecure"`
	MetricExportInterval     string  `koanf:"metric_export_interval"`
	SuccessfulGetSampleRatio float64 `koanf:"successful_get_sample_ratio"`
}

OtelConfig holds OpenTelemetry settings.

type OversubscriptionConfig added in v0.0.6

type OversubscriptionConfig struct {
	CPU     float64 `koanf:"cpu"`
	Memory  float64 `koanf:"memory"`
	Disk    float64 `koanf:"disk"`
	Network float64 `koanf:"network"`
	DiskIO  float64 `koanf:"disk_io"`
}

OversubscriptionConfig holds oversubscription ratios (1.0 = no oversubscription).

type RegistryConfig added in v0.0.6

type RegistryConfig struct {
	URL        string `koanf:"url"`
	Insecure   bool   `koanf:"insecure"`
	CACertFile string `koanf:"ca_cert_file"`
}

RegistryConfig holds OCI registry settings.

type SnapshotCompressionDefaultConfig added in v0.1.0

type SnapshotCompressionDefaultConfig struct {
	Enabled   bool   `koanf:"enabled"`
	Algorithm string `koanf:"algorithm"`
	Level     *int   `koanf:"level"`
}

SnapshotCompressionDefaultConfig holds default snapshot compression settings.

type SnapshotConfig added in v0.1.0

type SnapshotConfig struct {
	CompressionDefault SnapshotCompressionDefaultConfig `koanf:"compression_default"`
}

SnapshotConfig holds snapshot defaults.

Jump to

Keyboard shortcuts

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