config

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultBases = map[string]Base{
	"dev": {
		ParentImage: "ubuntu/24.04",
		SetupScript: "mcp:bases/dev.sh",
		Description: "Ubuntu 24.04 + git, curl, wget, jq, vim, build-essential",
	},
	"python": {
		From:        "dev",
		SetupScript: "mcp:bases/python.sh",
		Description: "dev + python3, pip, pipx, venv",
	},
	"node": {
		From:        "dev",
		SetupScript: "mcp:bases/node.sh",
		Description: "dev + Node 22 LTS, npm",
	},
}

DefaultBases is the set of bases shipped with the binary. Lives here (not internal/mcp) so config.Load() can merge them without importing internal/mcp (which would be a cycle). The embedded script *files* stay in internal/mcp/defaults.go via //go:embed.

Functions

func KnownHostsPath added in v0.6.0

func KnownHostsPath() string

KnownHostsPath returns the path to the pixels-managed SSH known_hosts file.

Types

type Base added in v0.6.0

type Base struct {
	ParentImage string `toml:"parent_image"`
	From        string `toml:"from"`
	SetupScript string `toml:"setup_script"`
	Description string `toml:"description"`
}

type Checkpoint

type Checkpoint struct {
	DatasetPrefix string `toml:"dataset_prefix" env:"PIXELS_CHECKPOINT_DATASET_PREFIX"`
}

type Config

type Config struct {
	Backend    string         `toml:"backend"    env:"PIXELS_BACKEND"` // "truenas" or "incus"
	TrueNAS    TrueNAS        `toml:"truenas"`
	Incus      Incus          `toml:"incus"`
	Defaults   Defaults       `toml:"defaults"`
	SSH        SSH            `toml:"ssh"`
	Checkpoint Checkpoint     `toml:"checkpoint"`
	Provision  Provision      `toml:"provision"`
	Network    Network        `toml:"network"`
	MCP        MCP            `toml:"mcp"`
	RawEnv     map[string]any `toml:"env"`

	// Resolved env vars (not from TOML directly).
	Env        map[string]string `toml:"-"` // image vars → /etc/environment
	EnvForward map[string]string `toml:"-"` // session vars → SSH SetEnv
}

func Load

func Load() (*Config, error)

func (*Config) MCPPIDFile added in v0.6.0

func (c *Config) MCPPIDFile() string

MCPPIDFile returns the resolved path to the MCP pidfile.

func (*Config) MCPStateFile added in v0.6.0

func (c *Config) MCPStateFile() string

MCPStateFile returns the resolved path to the MCP state file.

type Defaults

type Defaults struct {
	Image   string   `toml:"image"    env:"PIXELS_DEFAULT_IMAGE"`
	CPU     string   `toml:"cpu"      env:"PIXELS_DEFAULT_CPU"`
	Memory  int64    `toml:"memory"   env:"PIXELS_DEFAULT_MEMORY"` // MiB
	Pool    string   `toml:"pool"     env:"PIXELS_DEFAULT_POOL"`
	NICType string   `toml:"nic_type"` // "macvlan" or "bridged"
	Parent  string   `toml:"parent"`   // parent interface (e.g. "eno1", "br0")
	Network string   `toml:"network"`  // Incus network name (e.g. "incusbr0")
	DNS     []string `toml:"dns"`      // nameservers to write into containers
}

type Incus added in v0.5.0

type Incus struct {
	Socket     string `toml:"socket"      env:"PIXELS_INCUS_SOCKET"`
	Remote     string `toml:"remote"      env:"PIXELS_INCUS_REMOTE"`
	ClientCert string `toml:"client_cert" env:"PIXELS_INCUS_CLIENT_CERT"`
	ClientKey  string `toml:"client_key"  env:"PIXELS_INCUS_CLIENT_KEY"`
	ServerCert string `toml:"server_cert" env:"PIXELS_INCUS_SERVER_CERT"`
	Project    string `toml:"project"     env:"PIXELS_INCUS_PROJECT"`
}

type MCP added in v0.6.0

type MCP struct {
	Prefix           string          `toml:"prefix"             env:"PIXELS_MCP_PREFIX"`
	BasePrefix       string          `toml:"base_prefix"        env:"PIXELS_MCP_BASE_PREFIX"`
	DefaultImage     string          `toml:"default_image"      env:"PIXELS_MCP_DEFAULT_IMAGE"`
	IdleStopAfter    string          `toml:"idle_stop_after"    env:"PIXELS_MCP_IDLE_STOP_AFTER"`
	HardDestroyAfter string          `toml:"hard_destroy_after" env:"PIXELS_MCP_HARD_DESTROY_AFTER"`
	ReapInterval     string          `toml:"reap_interval"      env:"PIXELS_MCP_REAP_INTERVAL"`
	StateFile        string          `toml:"state_file"         env:"PIXELS_MCP_STATE_FILE"`
	PIDFile          string          `toml:"pid_file"           env:"PIXELS_MCP_PID_FILE"`
	ExecTimeoutMax   string          `toml:"exec_timeout_max"   env:"PIXELS_MCP_EXEC_TIMEOUT_MAX"`
	ListenAddr       string          `toml:"listen_addr"        env:"PIXELS_MCP_LISTEN_ADDR"`
	EndpointPath     string          `toml:"endpoint_path"      env:"PIXELS_MCP_ENDPOINT_PATH"`
	Bases            map[string]Base `toml:"bases"`
}

type Network

type Network struct {
	Egress string   `toml:"egress" env:"PIXELS_NETWORK_EGRESS"`
	Allow  []string `toml:"allow"`
}

func (*Network) IsRestricted

func (n *Network) IsRestricted() bool

type Provision

type Provision struct {
	Enabled  *bool `toml:"enabled"  env:"PIXELS_PROVISION_ENABLED"`
	DevTools *bool `toml:"devtools" env:"PIXELS_PROVISION_DEVTOOLS"`
}

func (*Provision) DevToolsEnabled

func (p *Provision) DevToolsEnabled() bool

func (*Provision) IsEnabled

func (p *Provision) IsEnabled() bool

type SSH

type SSH struct {
	User           string `toml:"user"             env:"PIXELS_SSH_USER"`
	Key            string `toml:"key"              env:"PIXELS_SSH_KEY"`
	StrictHostKeys *bool  `toml:"strict_host_keys" env:"PIXELS_SSH_STRICT_HOST_KEYS"`
}

func (*SSH) StrictHostKeysEnabled added in v0.6.0

func (s *SSH) StrictHostKeysEnabled() bool

StrictHostKeysEnabled returns whether SSH host key verification is enabled. Defaults to true when not explicitly set.

type TrueNAS

type TrueNAS struct {
	Host               string `toml:"host"                env:"PIXELS_TRUENAS_HOST"`
	Port               int    `toml:"port"                env:"PIXELS_TRUENAS_PORT"`
	Username           string `toml:"username"            env:"PIXELS_TRUENAS_USERNAME"`
	APIKey             string `toml:"api_key"             env:"PIXELS_TRUENAS_API_KEY"`
	InsecureSkipVerify *bool  `toml:"insecure_skip_verify" env:"PIXELS_TRUENAS_INSECURE"`
}

func (*TrueNAS) InsecureSkipVerifyValue

func (t *TrueNAS) InsecureSkipVerifyValue() bool

InsecureSkipVerify returns whether TLS verification should be skipped. Defaults to true (skip) when not explicitly set, since most TrueNAS boxes use self-signed certs.

Jump to

Keyboard shortcuts

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