Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigPath ¶
ConfigPath returns the XDG-compliant config file path.
func GetAPIKey ¶
func GetAPIKey() string
GetAPIKey returns the API key from the environment or config file. Environment variable DESEARCH_API_KEY takes precedence over config file. Returns an empty string if the key cannot be loaded.
func SaveConfig ¶
SaveConfig writes the configuration to the XDG config path. It creates the directory structure if it does not exist and sets permissions to 0600.
Types ¶
type Config ¶
type Config struct {
APIKey string `toml:"api_key"`
DefaultTools []string `toml:"default_tools"`
DefaultDateFilter string `toml:"default_date_filter"`
DefaultCount int `toml:"default_count"`
}
Config holds the application configuration.
func LoadConfig ¶
LoadConfig reads the configuration from the XDG config path. If the config file does not exist, it returns an empty Config and no error.
Click to show internal directories.
Click to hide internal directories.