Documentation
¶
Overview ¶
Package config loads the cuttle TOML config and resolves the active context.
The config is read-mostly: a single file at $XDG_CONFIG_HOME/cuttle/config.toml declares named contexts (where the browser runs) and named profiles (= seeds). A missing file yields a built-in "local" context, so cuttle needs zero config to drive a local docker browser.
Index ¶
Constants ¶
const ( BackendLocal = "local" BackendNative = "native" BackendK8s = "k8s" BackendSSH = "ssh" BackendDirect = "direct" )
Backend names selectable per context.
const ( StorageLocal = "local" StorageRemote = "remote" )
Storage modes for a profile.
const EnvContext = "CUTTLE_CONTEXT"
EnvContext is the environment variable that selects the active context.
Variables ¶
This section is empty.
Functions ¶
func DefaultPath ¶
func DefaultPath() string
DefaultPath is $XDG_CONFIG_HOME/cuttle/config.toml, falling back to ~/.config/cuttle/config.toml.
Types ¶
type Config ¶
type Config struct {
DefaultContext string `toml:"default_context"`
Contexts map[string]Context `toml:"context"`
Profiles map[string]Profile `toml:"profile"`
}
Config is the parsed config file. Missing keys leave zero values.
func Load ¶
Load reads the config from the default XDG path. A missing file is not an error: it returns a Config carrying only the built-in local context.
func LoadFrom ¶
LoadFrom reads a specific config file. A missing file yields the built-in local context. Unknown keys are rejected (strict mode) so a typo surfaces instead of silently doing nothing.
type Context ¶
type Context struct {
Backend string `toml:"backend"`
// k8s
Namespace string `toml:"namespace"`
Release string `toml:"release"`
KubeContext string `toml:"kube_context"`
NodeSelector map[string]string `toml:"node_selector"`
Tolerations []Toleration `toml:"tolerations"`
Resources *Resources `toml:"resources"`
// ssh
Host string `toml:"host"`
// direct
CDPURL string `toml:"cdp_url"`
VNCURL string `toml:"vnc_url"`
// applied at browser startup regardless of backend
Proxy string `toml:"proxy"`
}
Context describes where and how a browser runs. Which fields are meaningful depends on Backend; unused fields stay zero.
type Profile ¶
type Profile struct {
Storage string `toml:"storage"` // "local" (default) | "remote"
}
Profile is a named cuttle seed with a storage policy.