Documentation
¶
Overview ¶
Package config reads and writes ytrack's configuration directory:
config.yml general preferences hosts.yml per-host metadata and the default host (never secrets)
The directory is $YTRACK_CONFIG_DIR, else $XDG_CONFIG_HOME/ytrack, else %AppData%/ytrack on Windows, else ~/.config/ytrack.
Index ¶
- Constants
- func Dir() (string, error)
- func WriteFileAtomic(path string, data []byte) error
- type Config
- func (c *Config) Browser() string
- func (c *Config) DefaultHost() string
- func (c *Config) Dir() string
- func (c *Config) Host(key string) *HostEntry
- func (c *Config) HostKeys() []string
- func (c *Config) RemoveHost(key string)
- func (c *Config) Save() error
- func (c *Config) SetDefaultHost(key string) error
- func (c *Config) SetHost(key string, entry HostEntry)
- func (c *Config) Timezone() string
- type HostEntry
Constants ¶
const ( StorageKeyring = "keyring" StorageFile = "file" )
Storage values record where a host's token lives.
Variables ¶
This section is empty.
Functions ¶
func WriteFileAtomic ¶
WriteFileAtomic writes data to path with mode 0600, creating the parent directory with mode 0700, via a temp file and rename.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config is the loaded configuration.
func (*Config) DefaultHost ¶
DefaultHost returns the key of the default host, or "".
func (*Config) RemoveHost ¶
RemoveHost deletes a host entry. If it was the default, the first remaining host (sorted) becomes the default.
func (*Config) SetDefaultHost ¶
SetDefaultHost makes key the default host. The host must be known.