Documentation
¶
Index ¶
Constants ¶
const DefaultConfigDir = "~/.config/ghost"
Variables ¶
var BuildTime = "unknown"
var ErrNotLoggedIn = errors.New("not logged in")
var GitCommit = "unknown"
var Version = "dev"
These variables are set at build time via ldflags in the GoReleaser pipeline for production releases. Default values are used for local development builds.
Functions ¶
func PublicConfigOptions ¶
func PublicConfigOptions() []string
Types ¶
type Config ¶
type Config struct {
APIURL string `mapstructure:"api_url"`
Analytics bool `mapstructure:"analytics"`
Color bool `mapstructure:"color"`
DocsMCPURL string `mapstructure:"docs_mcp_url"`
Keyring bool `mapstructure:"keyring"`
ReadOnly bool `mapstructure:"read_only"`
ReleasesURL string `mapstructure:"releases_url"`
VersionCheck bool `mapstructure:"version_check"`
ConfigDir string `mapstructure:"-"`
// contains filtered or unexported fields
}
func Load ¶
Load creates a new Config instance. The provided flag set is used to bind CLI flags (analytics, color, version-check) so they override file/env values, and to resolve the effective config directory (via the config-dir flag).
func (*Config) GetCredentials ¶
func (c *Config) GetCredentials() (Credentials, error)
GetCredentials retrieves stored credentials (OAuth token or API key + project ID).
func (*Config) RemoveCredentials ¶
RemoveCredentials removes stored credentials from keyring and file fallback. When Keyring is disabled, the keyring is left untouched so that a logout in one config dir doesn't wipe credentials shared by another.
func (*Config) StoreCredentials ¶
func (c *Config) StoreCredentials(creds Credentials) error
StoreCredentials stores credentials (either an OAuth token or API key, plus project ID).
type ConfigOutput ¶
type ConfigOutput struct {
APIURL *string `mapstructure:"api_url" json:"api_url,omitempty"`
Analytics *bool `mapstructure:"analytics" json:"analytics,omitempty"`
Color *bool `mapstructure:"color" json:"color,omitempty"`
DocsMCPURL *string `mapstructure:"docs_mcp_url" json:"docs_mcp_url,omitempty"`
Keyring *bool `mapstructure:"keyring" json:"keyring,omitempty"`
ReadOnly *bool `mapstructure:"read_only" json:"read_only,omitempty"`
ReleasesURL *string `mapstructure:"releases_url" json:"releases_url,omitempty"`
VersionCheck *bool `mapstructure:"version_check" json:"version_check,omitempty"`
ConfigDir string `mapstructure:"-" json:"-"`
// contains filtered or unexported fields
}
func LoadForOutput ¶
func LoadForOutput(configDir string, env bool, all bool) (*ConfigOutput, error)
LoadForOutput loads config values for display purposes using a fresh viper instance, independent of CLI flags and global state.