config

package
v1.10.5 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package config implements the "config" CLI command and its subcommands for programmatic read/write access to individual configuration keys. It is intended for CI automation and scripted setup rather than interactive use (for interactive reconfiguration, use "init <subsystem>" instead).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCmdConfig

func NewCmdConfig(props *p.Props, opts ...MaskerOption) *cobra.Command

NewCmdConfig returns the top-level "config" command with all subcommands attached. MaskerOptions extend the built-in sensitive key and value patterns, allowing tool authors to register their own credential formats.

func NewCmdGet

func NewCmdGet(props *p.Props, masker *Masker) *cobra.Command

NewCmdGet returns the "config get <key>" subcommand.

func NewCmdList

func NewCmdList(props *p.Props, masker *Masker) *cobra.Command

NewCmdList returns the "config list" subcommand.

func NewCmdSet

func NewCmdSet(props *p.Props) *cobra.Command

NewCmdSet returns the "config set <key> <value>" subcommand.

func NewCmdValidate

func NewCmdValidate(props *p.Props) *cobra.Command

NewCmdValidate returns the "config validate" subcommand.

Types

type Masker

type Masker struct {
	// contains filtered or unexported fields
}

Masker detects and masks sensitive configuration values using two independent strategies: key-name pattern matching and value content regular expressions. The zero value is not useful; construct with NewMasker.

func NewMasker

func NewMasker(opts ...MaskerOption) *Masker

NewMasker constructs a Masker with built-in key patterns and value regexes, extended by any provided options. Built-in defaults are never mutated.

func (*Masker) IsSensitive

func (m *Masker) IsSensitive(key, value string) bool

IsSensitive returns true if the key's leaf segment matches a sensitive key pattern OR the value matches a sensitive value pattern.

func (*Masker) Mask

func (m *Masker) Mask(value string) string

Mask returns the value with all but the last 4 characters replaced by asterisks. Returns a fully asterisked string if the value is 4 characters or fewer.

func (*Masker) MaskIfSensitive

func (m *Masker) MaskIfSensitive(key, value string) string

MaskIfSensitive applies Mask only when IsSensitive returns true for the given key/value pair; otherwise returns the value unchanged.

type MaskerOption

type MaskerOption func(*Masker)

MaskerOption configures a Masker.

func WithKeyPattern

func WithKeyPattern(pattern string) MaskerOption

WithKeyPattern registers an additional key-name substring (case-insensitive) that marks a key as sensitive. Extends the built-in list; does not replace it.

func WithValuePattern

func WithValuePattern(re *regexp.Regexp) MaskerOption

WithValuePattern registers an additional compiled regexp that, when matched against a value, marks it as sensitive regardless of the key name.

Jump to

Keyboard shortcuts

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