config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package config resolves the CLI's connection context — the panel URL, API token, and active workspace — from flags, environment, and ~/.miabi/config.yaml, in that precedence. The token is never logged.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Path

func Path() string

Path returns the config file location (honoring MIABI_CONFIG, else ~/.miabi/config.yaml).

func Save

func Save(f *File) error

Save writes the config file, creating ~/.miabi with 0700 and the file with 0600 (it holds a token).

Types

type Effective

type Effective struct {
	URL       string
	Token     string
	Workspace *WorkspaceRef // from the file; may be nil
}

Effective is the resolved context a command runs against.

func Resolve

func Resolve(flagURL, flagToken string) (*Effective, error)

Resolve applies precedence flags → env (MIABI_URL/MIABI_TOKEN) → file.

type File

type File struct {
	URL       string        `yaml:"url,omitempty"`
	Token     string        `yaml:"token,omitempty"`
	Workspace *WorkspaceRef `yaml:"workspace,omitempty"`
}

File mirrors ~/.miabi/config.yaml.

func Load

func Load() (*File, error)

Load reads the config file. A missing file is not an error (returns an empty File), so CI that uses only env vars never needs one.

type WorkspaceRef

type WorkspaceRef struct {
	ID   uint   `yaml:"id" json:"id"`
	Name string `yaml:"name" json:"name"`
	Slug string `yaml:"slug" json:"slug"`
}

WorkspaceRef is the active workspace persisted by `miabi workspace switch`.

Jump to

Keyboard shortcuts

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