config

package
v1.9.2 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Profiles map[string]Profile `json:"profiles"`
}

Config is the on-disk declarative configuration file. It contains only stable fields suitable for dotfile management (url, username per profile). Runtime fields (JWT, current project, active profile pointer) live in State.

func Load

func Load() (*Config, error)

Load reads the config file from disk. A missing file yields an empty Config (not an error) — the caller treats absence of credentials as an auth error only when an actual command needs them.

If the on-disk file is in the old shape (has current_profile at top level or any profile has jwt / current_project_id), Load migrates those fields into the state file automatically and rewrites config.json without them.

func (*Config) Save

func (c *Config) Save() error

Save atomically writes the config to disk. Creates parent dirs (0700) and the file (0600). Atomicity is achieved by writing to a tempfile in the same directory and renaming over the destination.

type Profile

type Profile struct {
	URL      string `json:"url"`
	Username string `json:"username"`
}

Profile holds connection parameters for a single Traceway instance.

Jump to

Keyboard shortcuts

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