config

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrKeyringUnavailable = errors.New("keyring unavailable")

ErrKeyringUnavailable indicates the OS keyring is not accessible.

Functions

func DefaultPath

func DefaultPath() string

func Get

func Get(path, key string) (string, error)

func Save

func Save(path string, cfg *Config) error

func Set

func Set(path, key, value string) error

Types

type Config

type Config struct {
	Domain string `koanf:"domain" yaml:"domain"`
	Token  string `koanf:"token" yaml:"token"`

	// TokenSource indicates where the token was loaded from (not persisted).
	TokenSource TokenSource `koanf:"-" yaml:"-"`
}

func Load

func Load(path string) (*Config, error)

func (*Config) Validate

func (c *Config) Validate() error

type TokenSource added in v0.2.0

type TokenSource string

TokenSource describes where the token was resolved from.

const (
	TokenSourceNone    TokenSource = "none"
	TokenSourceKeyring TokenSource = "keyring"
	TokenSourceEnv     TokenSource = "env"
	TokenSourceFile    TokenSource = "file"
)

func SetToken added in v0.2.0

func SetToken(path, token string) (TokenSource, error)

SetToken stores the token using the most secure available backend. It tries the OS keyring first; if unavailable, falls back to the config file. Returns the storage location used and any error.

Jump to

Keyboard shortcuts

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