auth

package
v0.1.8 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigPath

func ConfigPath() (string, error)

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

func SaveConfig(c *Config) error

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

func LoadConfig() (*Config, error)

LoadConfig reads the configuration from the XDG config path. If the config file does not exist, it returns an empty Config and no error.

Jump to

Keyboard shortcuts

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