Documentation
¶
Overview ¶
Package config loads and validates ghalet settings and storage policy.
Index ¶
- Constants
- func CheckManagedPaths(managedPath, configPath string, reserved ...string) error
- func ManagedPath(configPath, selected string) (string, error)
- func ResolvePath(path string) (string, error)
- func RunnerGroupName(name string) string
- func ScopeURL(raw string) (*url.URL, error)
- func StateDirectory() (string, error)
- func TargetKey(scope, group, scaleSet string) (string, error)
- func ValidTargetID(id string) bool
- func WriteManaged(path string, before, after []byte) error
- type CapacityConfig
- type Config
- type Credential
- type DefaultsConfig
- type Duration
- type Editor
- type LogsConfig
- type Managed
- type ManagedTarget
- type RunnerConfig
- type ScalingConfig
- type Target
Constants ¶
const DefaultRunnerVersion = "2.338.0"
const (
SystemConfigPath = "/etc/ghalet/config.yaml"
)
Variables ¶
This section is empty.
Functions ¶
func CheckManagedPaths ¶
CheckManagedPaths rejects collisions with static configuration and other persistence files, including aliases through a final configuration symlink.
func ManagedPath ¶
ManagedPath resolves an explicit path relative to the static configuration. Nonstandard configurations get isolated files in the process's state directory.
func ResolvePath ¶
ResolvePath returns the lexical absolute configuration path, preserving symlinks.
func RunnerGroupName ¶
RunnerGroupName resolves an omitted group to GitHub's default runner group.
func StateDirectory ¶
StateDirectory returns the persistent application directory used by this process, resolving symlinks in its trusted storage base.
func TargetKey ¶
TargetKey returns a filesystem-safe identity for a scope/group/scale set registration.
func ValidTargetID ¶
ValidTargetID reports whether an ID is safe for a target's managed directory.
func WriteManaged ¶
WriteManaged commits a prepared snapshot without overwriting another writer.
Types ¶
type CapacityConfig ¶
type CapacityConfig struct {
MaxRunners int `yaml:"maxRunners"`
}
type Config ¶
type Config struct {
ManagedFile string `yaml:"managedFile"`
Defaults DefaultsConfig `yaml:"defaults"`
Capacity CapacityConfig `yaml:"capacity"`
Targets []Target `yaml:"targets"`
Runner RunnerConfig `yaml:"runner"`
Logs LogsConfig `yaml:"logs"`
Path string `yaml:"-"`
// contains filtered or unexported fields
}
func LoadConfig ¶
func ParseConfig ¶
ParseConfig resolves and validates configuration bytes without writing a file.
func (*Config) RetainSecretEnvironment ¶
RetainSecretEnvironment preserves credential variable history across applies.
func (*Config) SecretEnv ¶
SecretEnv reports management secrets, including previously configured names.
func (*Config) ValidateEnvironment ¶
ValidateEnvironment checks runner overrides against identity and secret policy.
type Credential ¶
type Credential struct {
Type string `yaml:"type"`
Hostname string `yaml:"hostname,omitempty"`
TokenEnv string `yaml:"tokenEnv,omitempty"`
TokenFile string `yaml:"tokenFile,omitempty"`
ClientID string `yaml:"clientId,omitempty"`
PrivateKeyFile string `yaml:"privateKeyFile,omitempty"`
}
func (*Credential) UnmarshalYAML ¶
func (c *Credential) UnmarshalYAML(unmarshal func(any) error) error
type DefaultsConfig ¶
type DefaultsConfig struct {
Credential *Credential `yaml:"credential"`
}
type Editor ¶
type Editor struct {
// contains filtered or unexported fields
}
Editor updates ghalet configuration mappings without discarding their order or comments. Aliases are expanded so replacing defaults cannot change explicit target credentials that referred to the old defaults.
func NewEditor ¶
NewEditor reads one configuration mapping. When schema is non-nil, it also decodes known fields into schema before allowing edits.
func (*Editor) AppendTarget ¶
AppendTarget adds a target with an explicit empty credential, avoiding inheritance of an unrelated default GitHub App installation.
func (*Editor) Marshal ¶
Marshal returns the edited configuration with its comments and mapping order.
func (*Editor) SetDefaultCredential ¶
SetDefaultCredential replaces defaults while leaving explicit targets intact.
type LogsConfig ¶
type Managed ¶
type Managed struct {
Version int `yaml:"version"`
Defaults DefaultsConfig `yaml:"defaults,omitempty"`
Targets []ManagedTarget `yaml:"targets,omitempty"`
}
Managed contains persistent setup information, not runnable target definitions or secret values. Targets become active only through the static configuration.
func ParseManaged ¶
func ReadManaged ¶
ReadManaged returns an empty document when the file does not exist.
func (*Managed) SetTarget ¶
func (managed *Managed) SetTarget(target ManagedTarget)
type ManagedTarget ¶
type ManagedTarget struct {
Scope string `yaml:"scope"`
RunnerGroup string `yaml:"runnerGroup,omitempty"`
ScaleSetName string `yaml:"scaleSet"`
Credential Credential `yaml:"credential"`
InstallationID int64 `yaml:"installationId,omitempty"`
}
type RunnerConfig ¶
type ScalingConfig ¶
type Target ¶
type Target struct {
ID string `yaml:"-"` // Derived from the registration, never configured.
URL string `yaml:"scope"`
Credential Credential `yaml:"credential"`
InstallationID int64 `yaml:"installationId"`
RunnerGroup string `yaml:"runnerGroup"`
ScaleSetName string `yaml:"scaleSet"`
Scaling ScalingConfig `yaml:"scaling"`
// contains filtered or unexported fields
}