Documentation
¶
Overview ¶
Package config loads testfleet runtime configuration from environment variables.
All configuration is sourced from env vars (no YAML file in MVP). This keeps secret handling explicit and CI/skill invocations stateless. Future versions may layer a `~/.testfleet/config.yaml` on top — Load is structured so that addition is a non-breaking change.
Index ¶
Constants ¶
const ( EnvOAuthClientID = "TAILSCALE_OAUTH_CLIENT_ID" EnvOAuthClientSecret = "TAILSCALE_OAUTH_CLIENT_SECRET" EnvAPIToken = "TAILSCALE_API_TOKEN" EnvTailnet = "TAILSCALE_TAILNET" EnvStateDir = "TESTFLEET_STATE_DIR" EnvSSHKey = "TESTFLEET_SSH_KEY" EnvSSHUser = "TESTFLEET_SSH_USER" EnvTag = "TESTFLEET_TAG" )
Env var names. Kept as exported constants so tests and docs can reference them.
const (
DefaultTag = "tag:testfleet"
)
Defaults.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
OAuthClientID string
OAuthClientSecret string
APIToken string // optional shortcut; when set, skips OAuth flow
Tailnet string
SSHKey string
SSHUser string
Tag string
// contains filtered or unexported fields
}
Config is the resolved runtime configuration.
func Load ¶
Load reads env vars and returns a populated Config.
Required: OAuth client id, OAuth client secret, tailnet, SSH key path, SSH user. Optional: state dir (defaults to $HOME/.testfleet), tag (defaults to tag:testfleet).
Missing required vars return *ErrMissingEnv listing every missing key. The state dir is resolved but not created here; call StateDir() to ensure it exists on disk (with mode 0700).
func (*Config) RawStateDir ¶
RawStateDir returns the configured state dir path without touching the filesystem. Use for diagnostics / human output; use StateDir for anything that needs the dir to exist.
type ErrMissingEnv ¶
type ErrMissingEnv struct {
Vars []string
}
ErrMissingEnv is returned when one or more required env vars are unset. The error message lists every missing var so the user can fix them in one pass.
func (*ErrMissingEnv) Error ¶
func (e *ErrMissingEnv) Error() string
func (*ErrMissingEnv) Is ¶
func (e *ErrMissingEnv) Is(target error) bool
Is so errors.Is(err, &ErrMissingEnv{}) works regardless of which vars are missing.