Documentation
¶
Overview ¶
Package config loads the Apple Business API settings from the gitignored .env.
Index ¶
Constants ¶
const ( DefaultScope = "business.api" DefaultTokenURL = "https://account.apple.com/auth/oauth2/token" DefaultTokenAud = "https://account.apple.com/auth/oauth2/v2/token" DefaultAPIBase = "https://api-business.apple.com/v1/" )
Default Apple Business endpoints/scope (used when unset in a context/.env/env).
Variables ¶
This section is empty.
Functions ¶
func ContextsPath ¶
func ContextsPath() string
ContextsPath is ~/.abctl/contexts.yaml, overridable via $ABCTL_CONTEXTS (tests/CI).
Types ¶
type Config ¶
type Config struct {
ClientID string
KeyPath string // absolute path to the unencrypted EC private key (PKCS#8 or SEC1)
Scope string
TokenURL string
TokenAud string
APIBase string
EnvDir string // base dir the gitops tree + secrets/ paths resolve against
}
Config is the resolved Apple Business API configuration.
func Resolve ¶
Resolve resolves the Apple Business config. Precedence: (1) a named connection context — the explicit selector, else $ABCTL_CONTEXT, else the active context in ~/.abctl/contexts.yaml; then (2) $ABCTL_ENV / the nearest .env walking up from the cwd; then (3) the process environment (AB_* — the 12-factor CI path).
type Context ¶
type Context struct {
ClientID string `yaml:"client_id" json:"client_id"`
KeyPath string `yaml:"key" json:"key"` // path to the EC private key (resolved relative to the file if not absolute)
APIBase string `yaml:"api_base,omitempty" json:"api_base,omitempty"`
Scope string `yaml:"scope,omitempty" json:"scope,omitempty"`
TokenURL string `yaml:"token_url,omitempty" json:"token_url,omitempty"`
TokenAud string `yaml:"token_aud,omitempty" json:"token_aud,omitempty"`
}
Context is one named Apple Business connection (client id + key + endpoints), stored in ~/.abctl/contexts.yaml so an operator can switch between organizations/tenants. The json tags mirror the yaml tags so `context get -o json|yaml` emits lowercase snake_case (client_id/key/api_base/…) consistent with every other payload — not the Go field names. Only the key PATH is ever surfaced, never key material.
type Contexts ¶
type Contexts struct {
Current string `yaml:"current,omitempty" json:"current,omitempty"`
Contexts map[string]Context `yaml:"contexts" json:"contexts"`
}
Contexts is the on-disk store: a set of named contexts + the active one.
func LoadContexts ¶
LoadContexts reads the context store; a missing file yields an empty store.