config

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: MIT Imports: 11 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"`
	Otel             OtelConfig             `koanf:"otel"`
	Logging          LoggingConfig          `koanf:"logging"`
	Build            BuildConfig            `koanf:"build"`
	Registry         RegistryConfig         `koanf:"registry"`
	Limits           LimitsConfig           `koanf:"limits"`
	Oversubscription OversubscriptionConfig `koanf:"oversubscription"`
	Capacity         CapacityConfig         `koanf:"capacity"`
	Hypervisor       HypervisorConfig       `koanf:"hypervisor"`
	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 GPUConfig added in v0.0.6

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

GPUConfig holds GPU-related settings.

type HypervisorConfig added in v0.0.6

type HypervisorConfig struct {
	Default string `koanf:"default"`
}

HypervisorConfig holds hypervisor 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 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 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"`
}

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.

Jump to

Keyboard shortcuts

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