config

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package config reads and writes the CLI's credentials file.

The file holds a server address and a token, and nothing else. Analysis scopes are not stored: they come from the process environment (see the env package), because several agents can share a machine while serving different projects.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Path

func Path() (string, error)

Path returns the credentials file the current invocation reads and writes. METAXISDATA_CONFIG points at a specific file, which is how one machine keeps several identities apart; otherwise the XDG configuration directory is used.

func Save

func Save(path string, credentials *Credentials) error

Save writes the file with owner-only permissions, creating its directory if needed. It writes a temporary file and renames it, so a crash cannot leave a half-written credentials file behind.

Types

type Credentials

type Credentials struct {
	Server         string    `json:"server"`
	Token          string    `json:"token"`
	User           *User     `json:"user,omitempty"`
	TokenExpiresAt time.Time `json:"tokenExpiresAt,omitzero"`
}

Credentials is the on-disk shape. The token is written in clear text: the CLI treats a credential file as equivalent to a seven day session, and hiding it from a local file was not worth a keychain dependency.

func Load

func Load(path string) (*Credentials, error)

Load reads the credentials file. A missing file is not an error: it simply means nothing has been configured yet, and the caller decides what to do.

func (*Credentials) Clear

func (c *Credentials) Clear()

Clear removes the token but keeps the server address: signing out is not the same as pointing at another server, and the address does not change.

type User

type User struct {
	Email string `json:"email,omitempty"`
	Name  string `json:"name,omitempty"`
}

User is the signed-in identity, kept for `auth status` and for the confirmation the CLI prints after a login.

Jump to

Keyboard shortcuts

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