Documentation
¶
Index ¶
- Constants
- Variables
- func AccountsDir() string
- func ConfigDir() string
- func ConfigFilePath() string
- func EnsureConfigDir() error
- type Client
- type Config
- func (c *Config) GetClient(email string) Client
- func (c *Config) GetDefaultAccount() string
- func (c *Config) GetTimezone() string
- func (c *Config) RemoveAccount(email string)
- func (c *Config) Save() error
- func (c *Config) SetClient(email string, client Client)
- func (c *Config) SetDefaultAccount(email string)
- func (c *Config) SetTimezone(tz string)
Constants ¶
const ( DefaultClientID = "51e726d0-22a4-45f7-a71c-b472ff84c027" DefaultTenantID = "common" )
const DefaultNamespace = "olk"
DefaultNamespace is the storage namespace of released and installed builds.
Variables ¶
var Namespace = DefaultNamespace
Namespace names the configuration directory and the credential-store entries this binary uses. Released builds keep DefaultNamespace. `make build` sets it at link time to "olk-dev", so a development binary keeps its own accounts and tokens and never reads or rewrites an installed binary's keychain items, which on macOS would otherwise raise Keychain prompts for whichever of the two builds did not create the item.
Functions ¶
func AccountsDir ¶
func AccountsDir() string
func ConfigFilePath ¶
func ConfigFilePath() string
func EnsureConfigDir ¶
func EnsureConfigDir() error
Types ¶
type Client ¶
type Client struct {
ClientID string `json:"client_id"`
TenantID string `json:"tenant_id,omitempty"`
}
Client represents an OAuth2 client configuration
type Config ¶
type Config struct {
DefaultAccount string `json:"default_account,omitempty"`
Clients map[string]Client `json:"clients,omitempty"`
Timezone string `json:"timezone,omitempty"`
// contains filtered or unexported fields
}
Config represents the olk configuration
func (*Config) GetDefaultAccount ¶
GetDefaultAccount returns the default account
func (*Config) GetTimezone ¶ added in v0.6.0
GetTimezone returns the configured display timezone
func (*Config) RemoveAccount ¶
RemoveAccount removes an account from config
func (*Config) SetDefaultAccount ¶
SetDefaultAccount sets the default account
func (*Config) SetTimezone ¶ added in v0.6.0
SetTimezone sets the display timezone