Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
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 {
DefaultProfile string `json:"default_profile"`
Profiles []Profile `json:"profiles,omitempty"`
PackageName string `json:"package_name,omitempty"`
Timeout DurationValue `json:"timeout"`
TimeoutSeconds DurationValue `json:"timeout_seconds"`
UploadTimeout DurationValue `json:"upload_timeout"`
UploadTimeoutSeconds DurationValue `json:"upload_timeout_seconds"`
MaxRetries int `json:"max_retries,omitempty"`
RetryDelay string `json:"retry_delay,omitempty"`
Debug string `json:"debug"`
}
Config holds the application configuration.
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.
type Profile ¶
type Profile struct {
Name string `json:"name"`
Type string `json:"type"`
KeyPath string `json:"key_path,omitempty"`
TokenPath string `json:"token_path,omitempty"`
ClientID string `json:"client_id,omitempty"`
ClientSecret string `json:"client_secret,omitempty"`
}
Profile stores a named auth profile in config.json.