config

package
v1.0.18 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HashToken

func HashToken(token string) (string, error)

HashToken produces an argon2id hash of the given token, encoded in the PHC-style format expected by VerifyToken.

func VerifyToken

func VerifyToken(token, encoded string) (bool, error)

VerifyToken checks token against an argon2id PHC string.

Types

type APIKey

type APIKey struct {
	ID          string   `yaml:"id"`
	SecretHash  string   `yaml:"secret_hash"`
	Scopes      []string `yaml:"scopes"`
	Description string   `yaml:"description,omitempty"`
}

APIKey is one entry from auth/keys.yaml.

func ParseKeysYAML

func ParseKeysYAML(raw []byte) ([]APIKey, error)

ParseKeysYAML parses an `auth/keys.yaml` file body.

func (APIKey) HasScope

func (k APIKey) HasScope(want string) bool

HasScope returns true if the key holds the requested scope, supporting "*" wildcard suffix at the action level only ("instances:*" matches "instances:read").

type Host

type Host struct {
	ID     string            `yaml:"id"`
	Addr   string            `yaml:"addr"`              // "unix" or "user@host"
	Socket string            `yaml:"socket"`            // path on the host
	SSHKey string            `yaml:"ssh_key,omitempty"` // optional
	Labels map[string]string `yaml:"labels,omitempty"`
	// Drain, when true, makes the API refuse to *create* new instances on
	// this host. Replace-shaped writes against existing pods, lifecycle
	// ops, and reads are unaffected. Hot-reloadable via SIGHUP.
	Drain bool `yaml:"drain,omitempty"`
	// Prune is the optional per-host host-health cleanup policy. nil means "use
	// the global flag defaults". Pointer fields inside distinguish "unset"
	// (inherit default) from an explicit zero value.
	Prune *PruneConfig `yaml:"prune,omitempty"`
	// CaddyAdminAddr is the Caddy admin API address (host:port) on this host,
	// e.g. "100.64.1.2:2019". When set, the ingress controller targets this
	// address instead of the global -ingress-caddy-admin-addr default. Empty
	// means use the global default.
	CaddyAdminAddr string `yaml:"caddy_admin_addr,omitempty"`
}

Host is the in-memory representation of a single hosts/*.yaml file.

func LoadHosts

func LoadHosts(dir string) ([]Host, error)

LoadHosts reads every *.yaml in dir into a Host. Unknown fields are rejected. Duplicate IDs are an error.

type Operator

type Operator struct {
	Username     string `yaml:"username"`
	PasswordHash string `yaml:"password_hash"`
}

Operator is the single-operator UI credential, parsed from the -operator-file YAML. PasswordHash is an argon2id PHC string (produce one with `podman-api hash-token <plaintext>`).

func ParseOperatorYAML

func ParseOperatorYAML(raw []byte) (Operator, error)

ParseOperatorYAML parses an operator credential file. Username defaults to "operator" when omitted; password_hash is required.

type PruneConfig

type PruneConfig struct {
	Enabled       *bool     `yaml:"enabled,omitempty"`
	Interval      *string   `yaml:"interval,omitempty"` // Go duration, e.g. "12h"
	DiskThreshold *int      `yaml:"disk_threshold_pct,omitempty"`
	Scope         *[]string `yaml:"scope,omitempty"`
	DryRun        *bool     `yaml:"dry_run,omitempty"`
}

PruneConfig is the raw per-host prune policy as parsed from hosts/*.yaml. Every field is a pointer so an omitted field inherits the global default rather than overriding it with a zero value. Resolution lives in the prune package (config must not depend on prune).

Jump to

Keyboard shortcuts

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