config

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultAuth        = "https://auth.api.norcube.com"
	DefaultWebApp      = "https://app.norcube.com"
	DefaultSnapDB      = "https://snapdb.api.norcube.com/app/v1"
	DefaultLangsync    = "https://langsync.api.norcube.com"
	DefaultDomainradar = "https://domainradar.api.norcube.com/app/v1"
	DefaultBilling     = "https://billing.api.norcube.com/app/v1"
	DefaultPrompthub   = "https://prompthub.api.norcube.com"
)

Defaults applied when no config file exists yet. Override via env or flags.

These point at the production Norcube environment. To target a non-prod environment, pass --auth-url / --web-app on `norcube login` and the values are persisted to the user's config file, or set the NORCUBE_AUTH_URL / NORCUBE_WEB_APP / NORCUBE_*_URL env vars per command.

Variables

This section is empty.

Functions

func Path

func Path() (string, error)

Path returns the canonical config file location. Honors XDG_CONFIG_HOME.

func Save

func Save(cfg *Config) error

Save persists the current config back to disk, creating the directory if needed.

Types

type Config

type Config struct {
	// Auth is the base URL of the auth service (e.g. https://auth.api.norcube.com).
	// This is the source of identity for the CLI; every per-service token
	// is minted from a refresh token issued here.
	Auth string `koanf:"auth"`
	// WebApp is the base URL of the Norcube web app, used to open /cli-login during browser auth.
	WebApp string `koanf:"web_app"`
	// SnapDB / Langsync / Domainradar / Billing / Prompthub base URLs are optional overrides.
	SnapDB      string `koanf:"snapdb"`
	Langsync    string `koanf:"langsync"`
	Domainradar string `koanf:"domainradar"`
	Billing     string `koanf:"billing"`
	Prompthub   string `koanf:"prompthub"`

	User      User         `koanf:"user"`
	ActiveOrg Organization `koanf:"active_org"`
}

Config is the on-disk user configuration. It deliberately holds only non-secret state — refresh and access tokens live in the OS keyring.

func Load

func Load() (*Config, error)

Load reads (or initializes) the user config from $XDG_CONFIG_HOME/norcube/config.toml.

func (*Config) ResetServiceURLs

func (c *Config) ResetServiceURLs()

ResetServiceURLs overwrites every per-service URL with the current defaults while leaving the auth API URL, web-app URL, user, and active-org alone. Used by `norcube config reset-urls` to refresh installs whose persisted values predate a default change.

type Organization

type Organization struct {
	ID   string `koanf:"id"`
	Slug string `koanf:"slug"`
	Name string `koanf:"name"`
}

type User

type User struct {
	ID    string `koanf:"id"`
	Name  string `koanf:"name"`
	Email string `koanf:"email"`
}

Jump to

Keyboard shortcuts

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