endpoint

package
v0.32.1 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 8 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 endpoint keeps the named claim-machinery-api endpoints of ~/.config/claims/config.yaml (claims#116), like the contexts of a kubeconfig: one per lab, each with its URL and the ZITADEL `claims login` uses for it. Nothing is pre-seeded: the file holds what the user added.

Index

Constants

View Source
const EnvConfigFile = "CLAIMS_CONFIG_FILE"

EnvConfigFile overrides where the config file lives.

View Source
const EnvEndpoint = "CLAIM_ENDPOINT"

EnvEndpoint names the endpoint to use (like --endpoint).

Variables

This section is empty.

Functions

func DefaultPath

func DefaultPath() (string, error)

DefaultPath is $CLAIMS_CONFIG_FILE, else <user config dir>/claims/config.yaml.

func NormalizeURL

func NormalizeURL(u string) string

NormalizeURL makes URLs comparable (no surrounding space or trailing slash).

Types

type Config

type Config struct {
	Current   string              `yaml:"current,omitempty"`
	Endpoints map[string]Endpoint `yaml:"endpoints,omitempty"`
	// Vaults are the labs' Vaults for `claims secret` (claims#122), keyed by
	// lab: the <lab> of secrets/<lab>/<mount>/<path>.enc.yaml.
	CurrentVault string           `yaml:"current-vault,omitempty"`
	Vaults       map[string]Vault `yaml:"vaults,omitempty"`
}

Config is the config file.

func Load

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

Load reads path; a missing file is an empty config.

func (*Config) Add

func (c *Config) Add(name string, e Endpoint) error

Add adds or replaces the endpoint name.

func (*Config) AddVault added in v0.32.0

func (c *Config) AddVault(lab string, v Vault) error

AddVault adds or replaces the Vault of lab.

func (*Config) ByURL

func (c *Config) ByURL(url string) (string, Endpoint, bool)

ByURL returns the name of the endpoint with url, if any.

func (*Config) Get

func (c *Config) Get(name string) (Endpoint, error)

Get returns the endpoint name.

func (*Config) GetVault added in v0.32.0

func (c *Config) GetVault(lab string) (Vault, bool)

GetVault returns the Vault of lab.

func (*Config) Names

func (c *Config) Names() []string

Names lists the endpoint names, sorted.

func (*Config) Remove

func (c *Config) Remove(name string) error

Remove deletes name; removing the current endpoint unsets current.

func (*Config) RemoveVault added in v0.32.0

func (c *Config) RemoveVault(lab string) error

RemoveVault deletes the Vault of lab.

func (*Config) Save

func (c *Config) Save(path string) error

Save writes c to path (directory 0700, file 0600).

func (*Config) Use

func (c *Config) Use(name string) error

Use makes name the current endpoint.

func (*Config) UseVault added in v0.32.0

func (c *Config) UseVault(lab string) error

UseVault makes lab the current lab of `claims secret`.

func (*Config) VaultNames added in v0.32.0

func (c *Config) VaultNames() []string

VaultNames lists the labs with a Vault, sorted.

type Endpoint

type Endpoint struct {
	URL      string `yaml:"url"`
	Issuer   string `yaml:"issuer,omitempty"`    // OIDC issuer for `claims login`
	ClientID string `yaml:"client-id,omitempty"` // native app of the issuer
	CAFile   string `yaml:"ca-file,omitempty"`   // extra PEM roots for the issuer
	// OrdersURL is the lab's machinery-order-service, for claims order and
	// claims orders (docs/adr/0002-order-through-the-order-service.md).
	OrdersURL string `yaml:"orders-url,omitempty"`
}

Endpoint is one claim-machinery-api.

type Vault added in v0.32.0

type Vault struct {
	Addr         string `yaml:"addr"`
	CAFile       string `yaml:"ca-file,omitempty"`
	Auth         string `yaml:"auth,omitempty"`          // token | approle ("" = token, else approle if VAULT_ROLE_ID is set)
	AppRoleMount string `yaml:"approle-mount,omitempty"` // default approle
}

Vault is the Vault of one lab.

Jump to

Keyboard shortcuts

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