config

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigDir

func ConfigDir() string

ConfigDir returns the absolute directory raff stores config in. Falls back to the current working directory when $HOME is unset (some minimal Docker base images don't set it for the root user) so the printed path is always absolute and copy-pasteable.

func ConfigPath

func ConfigPath() string

func MaskSecret added in v0.6.1

func MaskSecret(s string) string

MaskSecret keeps the first 9 characters ("raff_737e") and hides the rest.

func PromptInput

func PromptInput(reader *bufio.Reader, label, defaultVal string) string

func PromptSecret added in v0.6.1

func PromptSecret(reader *bufio.Reader, label, defaultVal string) string

PromptInput reads a line from stdin with an optional default value shown in brackets. PromptSecret is PromptInput for a secret: the stored value is shown only by its first characters, so a configured key never appears on screen.

func Resolve

func Resolve(flagVal, envKey string, configVal string) string

Resolve returns the effective value for a setting using priority: CLI flag > env var > config profile

Types

type Config

type Config struct {
	CurrentProfile string             `yaml:"current-profile"`
	Profiles       map[string]Profile `yaml:"profiles"`
}

func Load

func Load() (*Config, error)

func (*Config) ActiveProfile

func (c *Config) ActiveProfile() Profile

func (*Config) Save

func (c *Config) Save() error

type Profile

type Profile struct {
	APIURL    string `yaml:"api-url"`
	APIKey    string `yaml:"api-key"`
	ProjectID string `yaml:"project-id,omitempty"`
}

Jump to

Keyboard shortcuts

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