config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	APIKeyEnv = "CHATWOOT_API_KEY"
)

Variables

View Source
var ErrAPIKeyNotFound = errors.New("api key not found")

Functions

func ConfigDir

func ConfigDir() (string, error)

func ConfigPath

func ConfigPath() (string, error)

func DeleteAPIKey

func DeleteAPIKey(cfg *Config) error

func Save

func Save(cfg *Config) error

func SaveAPIKey

func SaveAPIKey(cfg *Config, apiKey string) error

Types

type Config

type Config struct {
	BaseURL   string `yaml:"base_url"`
	AccountID int    `yaml:"account_id"`
	UserID    int    `yaml:"user_id,omitempty"`
}

func Load

func Load() (*Config, error)

func (*Config) IsValid

func (c *Config) IsValid() bool

type CredentialSource

type CredentialSource string
const (
	CredentialSourceEnvironment CredentialSource = "environment"
	CredentialSourceKeyring     CredentialSource = "keyring"
	CredentialSourceMissing     CredentialSource = "missing"
)

func ResolveAPIKey

func ResolveAPIKey(cfg *Config) (string, CredentialSource, error)

ResolveAPIKey implements the auth flow for the CLI. YAML config intentionally stores only non-secrets, and plaintext api_key values from older configs are ignored. CHATWOOT_API_KEY wins for CI, coding agents, and temporary overrides; otherwise saved interactive logins read the token from the OS keyring.

Jump to

Keyboard shortcuts

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