Documentation ¶
Overview ¶
Package config provides configuration management, loading/saving and handling.
Index ¶
- func DefaultDataDir() string
- func DefaultMountpoint() string
- func HomeDir(path ...string) string
- type Account
- type Config
- func (c *Config) BlobPath() string
- func (c *Config) ConfigPath() string
- func (c *Config) DataPath(path ...string) string
- func (c *Config) FirstAccount() *Account
- func (c *Config) Load() error
- func (c *Config) Marshal() ([]byte, error)
- func (c *Config) MetadataPath() string
- func (c *Config) Read(r io.Reader) error
- func (c *Config) Save() error
- func (c *Config) Setup() error
- func (c *Config) Validate() bool
- func (c *Config) Write(w io.Writer) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultDataDir ¶
func DefaultDataDir() string
DefaultDataDir gets the default data directory for a user.
func DefaultMountpoint ¶
func DefaultMountpoint() string
DefaultMountpoint gets the default local path to mount to for a user.
Types ¶
type Account ¶
type Account struct { // Local path where a Drive directory will be mounted. LocalPath string `json:"local_path"` // File ID of the remote folder to be synced. RemoteId string `json:"remote_id"` // OAuth 2.0 Client ID for authorization and token refreshing. ClientId string `json:"client_id"` // OAuth 2.0 Client ID for authorization and token refreshing. ClientSecret string `json:"client_secret"` // OAuth 2.0 refresh token. RefreshToken string `json:"refresh_token"` }
Account is the configuration of a single account.
type Config ¶
type Config struct { // Base data directory DataDir string `json:"-"` // Omits from json marshal/unmarshal. // Accounts are the configured accounts. Accounts []*Account `json:"accounts"` }
Config contains the configuration for the running app.
func (*Config) ConfigPath ¶
ConfigPath is the path to the config file inside the data directory.
func (*Config) FirstAccount ¶
Hack while we only support one account
func (*Config) MetadataPath ¶
Metadata path is the path to the metadata database in the data directory.
Click to show internal directories.
Click to hide internal directories.