config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package config loads and validates Keyway runtime configuration from a YAML file and/or environment variables.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	DBURL          string          `yaml:"db_url"`
	APIAddr        string          `yaml:"api_addr"`
	APIToken       string          `yaml:"api_token"`
	ProbeAllowlist []string        `yaml:"probe_allowlist"`
	Slack          SlackConfig     `yaml:"slack"`
	Issuers        []IssuerConfig  `yaml:"issuers"`
	Discovery      DiscoveryConfig `yaml:"discovery"`
}

Config is the on-disk / environment configuration for the CLI and runner.

func Default

func Default() Config

Default returns a config seeded from environment variables.

func Load

func Load(path string) (Config, error)

Load reads a YAML config file, overlaying environment defaults for empty fields. A missing path returns the environment defaults with no error.

func LoadFile

func LoadFile(path string) (Config, error)

LoadFile reads a YAML config file WITHOUT overlaying environment variables. Read-modify-write commands (e.g. `issuer add`) use this so a marshal-back only ever persists what the file already contained — an ambient KEYWAY_API_TOKEN or KEYWAY_SLACK_WEBHOOK_URL is never written to disk as a side effect. A missing path returns an empty config with no error.

func Scaffold

func Scaffold() Config

Scaffold returns a config suitable for writing a fresh file: sane non-secret defaults only. It deliberately does NOT read secrets (API token, Slack webhook, DB URL) from the environment, so `keyway init` never captures an ambient secret into a plaintext file — those stay in the environment.

func (Config) Validate

func (c Config) Validate() error

Validate checks required fields for the given operation.

type DiscoveryConfig

type DiscoveryConfig struct {
	KubeContext string   `yaml:"kube_context"`
	Namespaces  []string `yaml:"namespaces"`
	ConfigPaths []string `yaml:"config_paths"`
}

DiscoveryConfig bounds default discovery scope.

type IssuerConfig

type IssuerConfig struct {
	Name               string `yaml:"name"`
	Type               string `yaml:"type"`
	URL                string `yaml:"url"`
	AdminCredentialEnv string `yaml:"admin_credential_env"`
}

IssuerConfig registers an issuer without embedding secrets — credentials are referenced by environment variable name only.

type SlackConfig

type SlackConfig struct {
	WebhookURL string `yaml:"webhook_url"`
}

SlackConfig configures the optional Slack notifier.

Jump to

Keyboard shortcuts

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