config

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package config reads and writes ~/.config/hadron/config.toml.

Index

Constants

View Source
const DefaultServer = "https://srv.hadronmemory.com"

DefaultServer is the hosted Hadron platform's API server (the GraphQL + OAuth host; hadronmemory.com itself is the portal).

Variables

View Source
var Keys = map[string]string{
	"server": "Hadron server base URL",
	"app":    "default App URN sent with requests (set via hadron app use)",
	"memory": "default memory URN or ID (set via hadron memory set-active)",
}

Keys lists the settings hadron config get/set accepts.

Functions

func AuthFile

func AuthFile() (string, error)

AuthFile returns the path of the fallback token file used when no OS keychain is available.

func Dir

func Dir() (string, error)

Dir returns the hadron config directory: $XDG_CONFIG_HOME/hadron, defaulting to ~/.config/hadron (gh-style, on every platform).

func EnsureDir

func EnsureDir() (string, error)

EnsureDir creates the config directory with owner-only permissions.

func File

func File() (string, error)

File returns the path of the main config file.

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

func Load

func Load() (*Config, error)

Load reads the config file if it exists; a missing file yields an all-defaults config.

func (*Config) All

func (c *Config) All() map[string]string

All returns every known key with its effective value.

func (*Config) App

func (c *Config) App() string

App returns the default App URN, or "" for no App context.

func (*Config) Get

func (c *Config) Get(key string) (string, error)

Get returns a known key's value.

func (*Config) Memory added in v0.3.0

func (c *Config) Memory() string

Memory returns the default memory URN or ID, or "" for no memory context.

func (*Config) Server

func (c *Config) Server() string

Server returns the configured server base URL, with the HADRON_SERVER environment variable taking precedence.

func (*Config) Set

func (c *Config) Set(key, value string) error

Set updates a known key and persists the file with 0600 perms.

func (*Config) Unset

func (c *Config) Unset(key string) error

Unset removes a key and persists the file.

Jump to

Keyboard shortcuts

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