Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SaveConfig ¶ added in v0.25.4
func SaveConfig(file string, config TomlConfig) error
SaveConfig saves the provided configuration to the specified file in TOML format.
Parameters: - file: a string representing the path to save the configuration. - config: a TomlConfig struct containing the configuration settings.
Returns: - error: an error indicating any issues encountered during the saving process.
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:"-"`
}
TomlConfig struct holds all other configuration structures.
func LoadConfig ¶
func LoadConfig(file string) (TomlConfig, error)
LoadConfig attempts to load and decode configuration file in TOML format, doing a minimal sanity checking and optionally returning an error.