Documentation
¶
Overview ¶
Package config loads the shared Python/Go CLI configuration.
Index ¶
- Constants
- func ConfigDir(getenv func(string) string, home, platform string) string
- func IsOrgBound(token string) bool
- func IsScoped(token string) bool
- func IsService(token string) bool
- func ValidateHost(host string) error
- type Config
- type CredentialKind
- type Hosts
- type Store
- func (s *Store) Clear(host string) (bool, error)
- func (s *Store) ClearDefaultOrg(host string) (bool, error)
- func (s *Store) Read() Hosts
- func (s *Store) ReadChecked() (Hosts, error)
- func (s *Store) Set(host, key, value string) error
- func (s *Store) Switch(host string) error
- func (s *Store) ValidateMutation() error
- func (s *Store) Write(h Hosts) error
Constants ¶
const DefaultHost = "https://api.avrea.com"
Variables ¶
This section is empty.
Functions ¶
func IsOrgBound ¶ added in v0.9.0
IsOrgBound reports a token bound to one organization with no user behind it: /users/me routes and stored organization defaults do not apply.
func ValidateHost ¶
Types ¶
type Config ¶
type CredentialKind ¶ added in v0.9.0
type CredentialKind int
CredentialKind is what a token authenticates as, decided by its prefix.
const ( // PersonalKey belongs to a user, who may belong to several organizations. PersonalKey CredentialKind = iota // ScopedToken (avs_) is minted by a member and bound to one organization. ScopedToken // ServiceToken (avt_) is owned by a group, has no user and is bound to one // organization. It is supplied only through AVR_TOKEN. ServiceToken )
func Kind ¶ added in v0.9.0
func Kind(token string) CredentialKind
func (CredentialKind) String ¶ added in v0.9.0
func (k CredentialKind) String() string
String names the kind in user-facing messages.
type Store ¶
type Store struct{ Path string }
Store is shared with Python. All credentials belong to the caller's resolved host.
func DefaultStore ¶
func (*Store) ClearDefaultOrg ¶
ClearDefaultOrg removes only the active host's stored organization override. Tokens, unknown fields, host ordering and the selected default host survive.
func (*Store) ReadChecked ¶
ReadChecked distinguishes an absent store from an unreadable one.
func (*Store) ValidateMutation ¶
ValidateMutation refuses to discard a present but unreadable or malformed store. Reads remain lenient for commands that do not change credentials.