Documentation
¶
Overview ¶
Package config handles CLI configuration loading and persistence.
Configuration is stored in a YAML file at ~/.config/arcanecli.yml. This package provides functions to load, save, and access configuration values including the server URL, API key, and default environment.
Configuration File ¶
The configuration file uses the following format:
server_url: https://your-server.com api_key: your-api-key default_environment: "0" log_level: info
Version Information ¶
Version and Revision variables are set at build time via ldflags:
go build -ldflags "-X github.com/getarcaneapp/arcane/cli/internal/config.Version=1.0.0"
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( Version = "dev" Revision = "unknown" )
Version and build information - set via ldflags at build time
Functions ¶
func ConfigPath ¶
ConfigPath returns the absolute path to the configuration file. The config file is located at ~/.config/arcanecli.yml. Returns an error if the user's home directory cannot be determined.
func DefaultConfig ¶
DefaultConfig returns a Config with sensible default values. The defaults are:
- ServerURL: http://localhost:3552
- DefaultEnvironment: "0"
- LogLevel: "info"
func Load ¶
Load reads the configuration from disk and returns it. If the config file does not exist, default values are returned. Returns an error if the file exists but cannot be read or parsed.
func Save ¶
Save writes the configuration to disk. The config directory is created if it does not exist. The file is created with 0600 permissions for security.
func SetConfigPath ¶
SetConfigPath overrides the default configuration file location. Accepts absolute or relative paths and expands a leading ~ to the home directory.
Types ¶
This section is empty.