config

package
v0.0.2 Latest Latest
Warning

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

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

Documentation

Overview

Package config persists non-secret CLI preferences: the active profile, the default output mode, and per-profile base-URLs. It lives at config.toml under os.UserConfigDir() (XDG on Linux, %AppData% on Windows, Application Support on macOS) with mode 0600. API keys are NEVER stored here — those go in the OS keychain (see internal/auth).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Path

func Path() (string, error)

Path returns the config.toml location under the OS user config dir.

Types

type Config

type Config struct {
	ActiveProfile string             `toml:"active_profile,omitempty"`
	Output        string             `toml:"output,omitempty"`
	Profiles      map[string]Profile `toml:"profiles,omitempty"`
}

Config is the on-disk shape of config.toml.

func Load

func Load() (*Config, error)

Load reads config.toml. A missing file yields an empty (but usable) Config.

func (*Config) Save

func (c *Config) Save() error

Save writes config.toml (file mode 0600, dir 0700). The 0600 is a POSIX best-effort and a no-op on Windows; config.toml deliberately holds NO secrets (API keys live in the OS keychain), so secret protection does not rely on it.

func (*Config) SetProfile

func (c *Config) SetProfile(name, baseURL string)

SetProfile upserts a profile's base-URL.

type Profile

type Profile struct {
	BaseURL string `toml:"base_url"`
}

Profile is one environment: a base-URL (the matching API key lives in the keychain).

Jump to

Keyboard shortcuts

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