Documentation
¶
Overview ¶
Package userconfig reads and writes the installer's per-user state file at ~/.confighub/installer/state.yaml. The file records which "bootstrap" packages (notably kubernetes-resources) the user has already installed into ConfigHub, keyed by organization, so `installer new` can pull from them without re-installing on every invocation.
The file is scoped to one operator, not one organization — entries carry their organizationID so a single laptop signed into multiple orgs has a stable record per (org, package) pair.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultPath ¶
DefaultPath returns the path the installer writes to: ~/.confighub/installer/state.yaml. Honors $HOME for testing.
Types ¶
type InstallRecord ¶
type InstallRecord struct {
Package string `yaml:"package" json:"package"`
PackageVersion string `yaml:"packageVersion,omitempty" json:"packageVersion,omitempty"`
OrganizationID string `yaml:"organizationID" json:"organizationID"`
Server string `yaml:"server,omitempty" json:"server,omitempty"`
SpaceSlug string `yaml:"spaceSlug" json:"spaceSlug"`
InstalledAt string `yaml:"installedAt,omitempty" json:"installedAt,omitempty"`
}
InstallRecord captures one bootstrap install. Keyed on (Package, OrganizationID); ServerURL is informational. SpaceSlug is where the package was uploaded.
type State ¶
type State struct {
APIVersion string `yaml:"apiVersion" json:"apiVersion"`
Kind string `yaml:"kind" json:"kind"`
Metadata Metadata `yaml:"metadata" json:"metadata"`
Spec StateSpec `yaml:"spec" json:"spec"`
}
State is the on-disk shape of ~/.confighub/installer/state.yaml.
func Load ¶
Load reads state from path. Returns an empty State (no installs, not an error) if the file does not exist — a fresh laptop has no prior installs.
func (*State) FindInstall ¶
func (s *State) FindInstall(pkg, orgID string) *InstallRecord
FindInstall returns the install record matching (pkg, orgID), or nil if no such record exists. Empty orgID matches any.
func (*State) UpsertInstall ¶
func (s *State) UpsertInstall(r InstallRecord)
UpsertInstall replaces the existing record matching (pkg, orgID) or appends a new one. InstalledAt is set to now.
type StateSpec ¶
type StateSpec struct {
// Installs records each (organizationID, package) → Space slug
// the operator has bootstrapped. `installer new` consults this
// before pulling so the kubernetes-resources package only gets
// uploaded once per org.
Installs []InstallRecord `yaml:"installs,omitempty" json:"installs,omitempty"`
}