config

package
v0.10.4 Latest Latest
Warning

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

Go to latest
Published: May 29, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CookieJarPath added in v0.10.0

func CookieJarPath() (string, error)

CookieJarPath returns the path used for persisted API affinity cookies.

func Delete

func Delete() error

Delete removes the config file.

func HashAPIKey added in v0.6.0

func HashAPIKey(apiKey string) string

HashAPIKey returns the hex-encoded SHA-256 of an API key.

func Save

func Save(cfg Config) error

Save writes the config to disk atomically using a temp file + rename.

Types

type Config

type Config struct {
	Version      int               `json:"v,omitempty"`
	SessionToken string            `json:"session_token,omitempty"`
	SessionOrgID string            `json:"session_org_id,omitempty"`
	APIKeyOrgs   map[string]string `json:"api_key_orgs,omitempty"` // sha256(apiKey) -> orgID
}

func Load

func Load() (Config, error)

Load reads the config file. Returns a zero-value Config if the file does not exist or has an outdated version (the stale file is deleted automatically).

func (*Config) OrgIDForAPIKey added in v0.6.0

func (c *Config) OrgIDForAPIKey(apiKey string) string

OrgIDForAPIKey looks up the cached org ID for the given API key.

func (*Config) SetOrgIDForAPIKey added in v0.6.0

func (c *Config) SetOrgIDForAPIKey(apiKey, orgID string)

SetOrgIDForAPIKey caches an org ID for the given API key.

Jump to

Keyboard shortcuts

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