Documentation
¶
Overview ¶
Package config loads + writes the CLI config at ~/.getdebug/config.json.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInsecurePerms = errors.New("config file has insecure permissions; run `chmod 600 ~/.getdebug/config.json`")
ErrInsecurePerms is returned when the config file exists but has group/other read bits set. The token in this file is a long-lived bearer credential — any local process running as another user could pick it up. Refuse to use it until the user re-secures the file.
Functions ¶
Types ¶
type Config ¶
type Config struct {
APIBaseURL string `json:"apiBaseUrl,omitempty"`
Token string `json:"token,omitempty"`
UserEmail string `json:"userEmail,omitempty"`
}
Config holds the CLI's persistent state. Tokens live here; the user can delete the file to log out.
func Load ¶
Load reads the config. Returns an empty Config (not an error) when the file doesn't exist — the caller decides whether that's a problem.
If the file exists with group/other bits set (and we're on a Unix-like OS where those bits mean what we think they mean), the load fails with ErrInsecurePerms — better a loud error than silently using a token any local process can scrape.