config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConfigValue

func GetConfigValue(key ConfigKey) (string, error)

GetConfigValue retrieves a specific configuration value.

func SaveGlobalConfig

func SaveGlobalConfig(config *GlobalConfig) error

SaveGlobalConfig saves the global configuration to ~/.config/godig/config.yaml.

func SetConfigValue

func SetConfigValue(key ConfigKey, value string) error

SetConfigValue sets a specific configuration value and saves it.

Types

type ConfigKey

type ConfigKey string

ConfigKey represents a configuration key.

const (
	// KeyAPIKey is the configuration key for the API key.
	KeyAPIKey ConfigKey = "api-key"
	// KeyServer is the configuration key for the server address.
	KeyServer ConfigKey = "server"
)

type GlobalConfig

type GlobalConfig struct {
	APIKey string `yaml:"api_key,omitempty"`
	Server string `yaml:"server,omitempty"`
}

GlobalConfig represents the user's global configuration.

func LoadGlobalConfig

func LoadGlobalConfig() (*GlobalConfig, error)

LoadGlobalConfig loads the global configuration from ~/.config/godig/config.yaml. Returns an empty config if the file doesn't exist.

Jump to

Keyboard shortcuts

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