config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMCPTokenCorrupt = errors.New("stored MCP token is corrupt")

ErrMCPTokenCorrupt indicates a stored MCP token entry exists but could not be decoded. Callers treat this like a missing token: the entry is unusable, so re-authorizing is the only recovery.

Functions

func ApplyAuth

func ApplyAuth(req *http.Request, kt KeyType, key string)

func DefaultDir

func DefaultDir() string

func DefaultPath

func DefaultPath() string

func DeleteKey

func DeleteKey(profile string, kt KeyType) error

func GetKey

func GetKey(profile string, kt KeyType) (string, error)

func ManagementKey

func ManagementKey(id, secret string) string

ManagementKey encodes a management key's ID and secret into the single credential string the keyring stores and ApplyAuth sends as the bearer token. The id:secret wire format lives only here.

func SetKey

func SetKey(profile string, kt KeyType, value string) error

func SetManagementKey

func SetManagementKey(profile, id, secret string) error

SetManagementKey stores a management key, encoding its ID and secret so callers never assemble the id:secret wire format themselves.

Types

type Config

type Config struct {
	APIUrl        string              `json:"api_url,omitempty"`
	MCPUrl        string              `json:"mcp_url,omitempty"`
	ActiveProfile string              `json:"active_profile,omitempty"`
	Profiles      map[string]*Profile `json:"profiles,omitempty"`
}

func Load

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

func (*Config) EnsureProfile

func (c *Config) EnsureProfile(name string) *Profile

func (*Config) Save

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

type KeyType

type KeyType string
const (
	KeyConfig     KeyType = "config"
	KeyIngest     KeyType = "ingest"
	KeyManagement KeyType = "management"
)

func KeyTypes

func KeyTypes() []KeyType

KeyTypes returns every key type, in storage order. Callers that act on all key types (logout, status, profile listing) range over this rather than hand-listing the constants, so adding a key type updates them all.

func ParseKeyType

func ParseKeyType(s string) (KeyType, error)

type MCPStore

type MCPStore struct {
	// contains filtered or unexported fields
}

MCPStore persists the OAuth credentials for the Honeycomb MCP server in the OS keyring, scoped to a profile. The token set and the Dynamic Client Registration client ID are OAuth artifacts, not raw Honeycomb credentials, so they live behind their own store rather than in the KeyType vault and stay out of the login/status/KeyTypes machinery.

func NewMCPStore

func NewMCPStore(profile string) MCPStore

NewMCPStore returns the OAuth credential store for a profile.

func (MCPStore) ClientID

func (s MCPStore) ClientID() (string, error)

ClientID returns the stored OAuth client ID, or keyring.ErrNotFound when none has been registered.

func (MCPStore) DeleteClientID

func (s MCPStore) DeleteClientID() error

DeleteClientID removes the stored OAuth client ID.

func (MCPStore) DeleteToken

func (s MCPStore) DeleteToken() error

DeleteToken removes the stored OAuth token set.

func (MCPStore) SetClientID

func (s MCPStore) SetClientID(clientID string) error

SetClientID stores the DCR-registered OAuth client ID.

func (MCPStore) SetToken

func (s MCPStore) SetToken(v any) error

SetToken stores the OAuth token set, JSON-encoded under the {profile}:mcp keyring entry.

func (MCPStore) Token

func (s MCPStore) Token(v any) error

Token decodes the stored OAuth token set into v. It returns keyring.ErrNotFound when no token has been stored and ErrMCPTokenCorrupt when the stored entry cannot be decoded.

type Profile

type Profile struct {
	APIUrl string `json:"api_url,omitempty"`
	MCPUrl string `json:"mcp_url,omitempty"`
	Team   string `json:"team,omitempty"`
}

Jump to

Keyboard shortcuts

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