config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package config owns persisted settings, separate from private runtime credentials.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Edit

func Edit(key string, value *string) error

func EditFile

func EditFile(path, key string, value *string) error

EditFile edits only persisted values, independent of environment overrides.

func Path

func Path() (string, error)

Types

type RemoteValues

type RemoteValues struct {
	Host          string `json:"host"`
	Port          int    `json:"port"`
	State         string `json:"state"`
	Account       string `json:"account"`
	RetentionDays int    `json:"retentionDays"`
}

RemoteValues is deployment configuration, independent of personal CLI settings.

func LoadRemoteFile

func LoadRemoteFile(path string) (RemoteValues, error)

LoadRemoteFile resolves defaults, an explicitly selected file, then environment. It never discovers personal config, creates files, or acquires a config lock.

func (RemoteValues) ListenAddress

func (values RemoteValues) ListenAddress() (string, error)

ListenAddress validates the configured listener when no flag overrides it.

type ServerSettings

type ServerSettings struct {
	Host          string `json:"host"`
	Port          int    `json:"port"`
	State         string `json:"state"`
	WebDir        string `json:"webDir"`
	RetentionDays int    `json:"retentionDays"`
}

type Values

type Values struct {
	Host          string `json:"host"`
	Port          *int   `json:"port"`
	State         string `json:"state"`
	WebDir        string `json:"webDir"`
	Server        string `json:"server"`
	Token         string `json:"token"`
	RetentionDays int    `json:"retentionDays"`
}

func Default

func Default() (Values, error)

func Load

func Load() (Values, error)

Load creates defaults once. The lock also serializes first-use and config edits.

func LoadFile

func LoadFile(path string) (Values, error)

LoadFile resolves defaults, a JSON file, then environment overrides. It never persists environment values. An empty path selects the machine config.

func Merge

func Merge(values Values, raw string) (Values, error)

func ReadFile

func ReadFile(path string) (Values, error)

ReadFile reads persisted values only. An empty path selects the machine config.

func (Values) Settings

func (values Values) Settings() (ServerSettings, error)

func (Values) Validate

func (values Values) Validate() error

Jump to

Keyboard shortcuts

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