Documentation ¶
Overview ¶
Package app provides a base of the bot application. App handles command line arguments and manages mmbot.Robot.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var NewConfigTemplate = `` /* 1400-byte string literal not displayed */
NewConfigTemplate is a template for configuration file. You can change it content by adding your extra configuration entries. {{.Name}} is replaced with the application name.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct { *cli.App Config *Config ConfigLoader func(file string) (*Config, error) InitRobot func(*mmbot.Robot) error }
App is a bot application.
type CommonConfig ¶
type CommonConfig struct { Log string `toml:"log"` PIDFile string `toml:"pidfile"` // contains filtered or unexported fields }
CommonConfig is the configration of common category.
type Config ¶
type Config struct { Common CommonConfig `toml:"common"` Mattermost MattermostConfig `toml:"mattermost"` Server ServerConfig `toml:"server"` }
Config is the configuration of the application.
func LoadConfigFile ¶
LoadConfigFile loads configuration file and returns Config.
func (*Config) AdapterConfig ¶
AdapterConfig returns mmhook.Config.
func (*Config) RobotConfig ¶
RobotConfig returns mmbot.Config.
func (*Config) ValidateAndExitOnError ¶
func (c *Config) ValidateAndExitOnError()
ValidateAndExitOnError validates configuration values. Print log and exit if errors exist.
type MattermostConfig ¶
type MattermostConfig struct { OutgoingURL string `toml:"outgoing_url"` IncomingPath string `toml:"incoming_path"` Tokens []string `toml:"tokens"` UserName string `toml:"username"` OverrideUserName string `toml:"override_username"` IconURL string `toml:"icon_url"` InsecureSkipVerify bool `toml:"insecure_skip_verify"` }
MattermostConfig is the configuration for mattermost.
type ServerConfig ¶
type ServerConfig struct { Enable bool `toml:"enable"` BindAddress string `toml:"bind_address"` Port int `toml:"port"` }
ServerConfig is the configration for the bot HTTP server.