config

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package config stores the CLI's credentials and endpoint on disk.

Everything the CLI needs to make an authenticated request — the panel host, the OAuth client id and the tokens the device flow returned — lives in a single credentials.json under the user's config dir, written 0600.

Index

Constants

View Source
const (
	// DefaultHost is the hosted Kilden panel. Override at login with --host
	// (self-hosters) or the KILDEN_HOST environment variable.
	DefaultHost = "https://app.kilden.io"

	// DefaultClientID is the well-known PUBLIC OAuth client the panel seeds
	// with `php artisan passport:cli-client`. A public client carries no
	// secret, so shipping its id in the binary is expected, not a leak.
	DefaultClientID = "9c3f6a10-1b2c-4d5e-8f90-a1b2c3d4e5f6"
)

Variables

View Source
var ErrNotLoggedIn = errors.New("not signed in — run `kd login`")

ErrNotLoggedIn is returned when no credentials are stored yet.

Functions

func Clear

func Clear() error

Clear removes the stored credentials (idempotent).

func Dir

func Dir() (string, error)

Dir is the CLI's config directory (e.g. ~/.config/kilden on Linux).

Types

type Credentials

type Credentials struct {
	Host         string    `json:"host"`
	ClientID     string    `json:"client_id"`
	AccessToken  string    `json:"access_token"`
	RefreshToken string    `json:"refresh_token"`
	TokenType    string    `json:"token_type"`
	Expiry       time.Time `json:"expiry"`
	Scopes       string    `json:"scopes,omitempty"`
}

Credentials is the persisted session.

func Load

func Load() (*Credentials, error)

Load reads the stored credentials, or ErrNotLoggedIn if none exist.

func (*Credentials) Save

func (c *Credentials) Save() error

Save writes the credentials back, creating the config dir if needed.

Jump to

Keyboard shortcuts

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