Documentation
¶
Overview ¶
Package config manages profiles stored under the XDG config directory. Credentials are stored separately (see pkg/auth) and never here.
Index ¶
- Constants
- Variables
- func Dir() (string, error)
- func LockPath(path string) (func(), error)
- func NormalizeAPIURL(raw string) string
- func Path() (string, error)
- func StateDir() (string, error)
- func TryLockPath(path string) (func(), error)
- func ValidAddress(a string) bool
- func ValidName(n string) bool
- func ValidateAPIURL(raw string) error
- func WriteFileAtomic(path string, data []byte, perm os.FileMode) error
- type AutoUpdate
- type File
- type Profile
- type Telemetry
Constants ¶
const DefaultAPIURL = "https://accounts.icarus.tools"
DefaultAPIURL is the production Oku account API origin. It applies only to fresh profiles created without --api-url and to profile-less commands; existing profiles keep the api_url they stored. --api-url accepts a custom origin.
const NetworkMainnet = "mainnet"
NetworkMainnet is the only network the Oku backend currently serves (account/src/connectapi/perps/signing.go hardcodes Hyperliquid Mainnet).
Variables ¶
var ErrLocked = errors.New("lock held by another process")
ErrLocked reports that TryLockPath found the lock held by another process.
Functions ¶
func LockPath ¶
LockPath takes an exclusive, blocking, cross-process lock on path, creating it with mode 0600. The returned function releases it. It uses flock on Unix and LockFileEx on Windows; both are released automatically if the process dies.
func NormalizeAPIURL ¶
NormalizeAPIURL strips a trailing slash.
func TryLockPath ¶
TryLockPath is LockPath without waiting: it returns ErrLocked when another process holds the lock.
func ValidAddress ¶
ValidAddress reports whether a is a 20-byte hex address.
func ValidateAPIURL ¶
ValidateAPIURL requires https (http allowed only for loopback testing).
Types ¶
type AutoUpdate ¶
type AutoUpdate struct {
Enabled bool `json:"enabled"`
// Interval is the minimum time between background checks, as a Go
// duration string. Empty means the default (24h).
Interval string `json:"interval,omitempty"`
// Skills also refreshes installed bundled skills after an update.
Skills bool `json:"skills"`
}
AutoUpdate holds the opt-in background update preference.
type File ¶
type File struct {
Version int `json:"version"`
DefaultProfile string `json:"default_profile,omitempty"`
Profiles map[string]*Profile `json:"profiles"`
// Telemetry is global (not per profile) and off unless explicitly enabled.
Telemetry *Telemetry `json:"telemetry,omitempty"`
// AutoUpdate is global and off unless explicitly enabled.
AutoUpdate *AutoUpdate `json:"auto_update,omitempty"`
}
File is the persisted config document.
type Profile ¶
type Profile struct {
PrivyAppID string `json:"privy_app_id,omitempty"`
Network string `json:"network"`
APIURL string `json:"api_url"`
Account string `json:"account,omitempty"`
// CredentialStore records where the profile's credential lives on Linux:
// "file" (default, plain 0600 file) or "keyring" (Secret Service).
CredentialStore string `json:"credential_store,omitempty"`
}
Profile selects an account, network, and API origin.