config

package
v1.15.1 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: BSD-3-Clause Imports: 6 Imported by: 0

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

View Source
var (
	Version  = "dev"
	Revision = "unknown"
)

Version and build information - set via ldflags at build time

Functions

func ConfigPath

func ConfigPath() (string, error)

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

func DefaultConfig() *types.Config

DefaultConfig returns a Config with sensible default values. The defaults are:

func Load

func Load() (*types.Config, error)

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

func Save(c *types.Config) error

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

func SetConfigPath(path string) error

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.

Jump to

Keyboard shortcuts

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