Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidConfig = errors.New("invalid configuration")
ErrInvalidConfig is returned when config values fail validation.
var ErrInvalidPath = errors.New("invalid config path")
ErrInvalidPath is returned when the config path is invalid.
var ErrNotFound = fmt.Errorf("configuration not found")
ErrNotFound is returned when the config file doesn't exist
Functions ¶
func GlobalPath ¶
GlobalPath returns the global configuration file path.
Types ¶
type Config ¶
type Config struct {
KeyID string `json:"key_id"`
IssuerID string `json:"issuer_id"`
PrivateKeyPath string `json:"private_key_path"`
PrivateKeyPEM string `json:"-"`
DefaultKeyName string `json:"default_key_name"`
Keys []Credential `json:"keys,omitempty"`
KeychainMetadata []KeychainMetadata `json:"keychain_metadata,omitempty"`
AppID string `json:"app_id"`
VendorNumber string `json:"vendor_number"`
AnalyticsVendorNumber string `json:"analytics_vendor_number"`
SkillsCheckedAt string `json:"skills_checked_at,omitempty"`
Timeout DurationValue `json:"timeout"`
TimeoutSeconds DurationValue `json:"timeout_seconds"`
UploadTimeout DurationValue `json:"upload_timeout"`
UploadTimeoutSeconds DurationValue `json:"upload_timeout_seconds"`
MaxRetries string `json:"max_retries"`
BaseDelay string `json:"base_delay"`
MaxDelay string `json:"max_delay"`
RetryLog string `json:"retry_log"`
Debug string `json:"debug"`
}
Config holds the application configuration
type Credential ¶
type Credential struct {
Name string `json:"name"`
KeyID string `json:"key_id"`
IssuerID string `json:"issuer_id"`
PrivateKeyPath string `json:"private_key_path"`
}
Credential stores a named API credential in config.json.
type DurationValue ¶
DurationValue stores a duration with its raw string representation. It marshals to/from JSON as a string to preserve config compatibility.
func ParseDurationValue ¶
func ParseDurationValue(raw string) (DurationValue, error)
ParseDurationValue parses a duration string or seconds value into a DurationValue.
func (DurationValue) MarshalJSON ¶
func (d DurationValue) MarshalJSON() ([]byte, error)
MarshalJSON stores the raw string when available, preserving the config format.
func (DurationValue) String ¶
func (d DurationValue) String() string
String returns the raw string when available, falling back to the duration value.
func (*DurationValue) UnmarshalJSON ¶
func (d *DurationValue) UnmarshalJSON(data []byte) error
UnmarshalJSON parses duration strings or seconds values from JSON.