Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SaveConfig ¶
func SaveConfig(file string, config TomlConfig) error
SaveConfig atomically writes config to file as TOML with 0600 permissions.
Types ¶
type Calendar ¶
type Calendar struct {
Name string `toml:"name,omitempty"`
}
Calendar struct hold Google Calendar configuration.
type Discord ¶
type Discord struct {
Token string `toml:"token,omitempty"`
UserIDs []string `toml:"userids,omitempty"`
}
Discord struct holds Discord messenger configuration.
type Mail ¶
type Mail struct {
Server string `toml:"server,omitempty"`
Port string `toml:"port,omitempty"`
Username string `toml:"username,omitempty"`
Password string `toml:"password,omitempty"`
From string `toml:"from,omitempty"`
Subject string `toml:"subject,omitempty"`
To []string `toml:"to,omitempty"`
}
Mail struct hold mail messenger configuration.
type Slack ¶
type Slack struct {
Token string `toml:"token,omitempty"`
ChatIDs []string `toml:"chatids,omitempty"`
}
Slack struct holds Slack messenger configuration.
type Telegram ¶
type Telegram struct {
Token string `toml:"token,omitempty"`
ChatIDs []string `toml:"chatids,omitempty"`
}
Telegram struct holds Telegram messenger configuration.
type TomlConfig ¶
type TomlConfig struct {
Calendar Calendar `toml:"calendar,omitempty"`
Mail Mail `toml:"mail,omitempty"`
Telegram Telegram `toml:"telegram,omitempty"`
Discord Discord `toml:"discord,omitempty"`
Slack Slack `toml:"slack,omitempty"`
User []User `toml:"user,omitempty"`
WhatsApp WhatsApp `toml:"whatsapp,omitempty"`
TelegramEnabled bool `toml:"-"` // derived at runtime; never read from or written to TOML
DiscordEnabled bool `toml:"-"`
SlackEnabled bool `toml:"-"`
MailEnabled bool `toml:"-"`
CalendarEnabled bool `toml:"-"`
WhatsAppEnabled bool `toml:"-"`
// CalendarDeferred: Calendar is configured but not yet initialized (e.g.
// headless daemon before OAuth); msgSend runs a queue-only stub to preserve
// exams.
CalendarDeferred bool `toml:"-"`
}
TomlConfig struct holds all other configuration structures.
func LoadConfig ¶
func LoadConfig(file string) (TomlConfig, error)
LoadConfig decodes the TOML config at file and runs per-messenger validation, enabling each messenger whose block validates. Fatal on an invalid block or when no messenger is enabled.
Click to show internal directories.
Click to hide internal directories.