Documentation ¶
Index ¶
- func LoadConfigFromBytes(data []byte, conf *Config) error
- func LoadConfigFromEnvVars(ctx context.Context, prefix string, conf *Config) error
- func LoadConfigFromFile(filepath string, conf *Config) error
- func LoadConfigFromFileAndEnvVars(ctx context.Context, envVarsPrefix, filepath string, conf *Config) error
- func WakeUp(_ context.Context, conf Config, bus EventBus.Bus) error
- type Config
- type ConfigBot
- type ConfigBotServer
- type ConfigChannels
- type ConfigLinks
- type ConfigStaff
- type ConfigTwitter
- type Context
- type EventHandler
- type SlackContext
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadConfigFromBytes ¶
LoadConfigFromBytes loads config from a raw []byte TOML file
func LoadConfigFromEnvVars ¶
LoadConfigFromEnvVars reads config from env vars and maps that into the given Config struct.
func LoadConfigFromFile ¶
LoadConfigFromFile reads a TOML file and unmarshals that config into the given Config struct.
func LoadConfigFromFileAndEnvVars ¶
func LoadConfigFromFileAndEnvVars(ctx context.Context, envVarsPrefix, filepath string, conf *Config) error
LoadConfigFromFileAndEnvVars reads config and maps that into the given Config in the following order: 1. Loads from Toml file. 2. Loads from env vars. Note: env var values will overwrite TOML file values.
Types ¶
type Config ¶
type Config struct { Bot ConfigBot `env:",prefix=BOT_"` Staff ConfigStaff `env:",prefix=STAFF_"` Channels ConfigChannels `env:",prefix=CHANNELS_"` Links ConfigLinks `env:",prefix=LINKS_"` Twitter ConfigTwitter `env:",prefix=TWITTER_"` TwitterContestToken string `env:"TWITTER_CONTEST_TOKEN"` TwitterContestURL string `env:"TWITTER_CONTEST_URL"` NewRelicLicenseKey string `env:"NEW_RELIC_LICENSE_KEY"` Debug bool `env:"DEBUG"` Version string `env:"VERSION"` }
type ConfigBotServer ¶
type ConfigChannels ¶
type ConfigLinks ¶
type ConfigStaff ¶
type ConfigStaff struct {
Members []string `env:"MEMBERS"`
}
type ConfigTwitter ¶
type ConfigTwitter struct { twitter.Credentials APIKey string `env:"API_KEY"` APIKeySecret string `env:"API_KEY_SECRET"` }
type Context ¶
type EventHandler ¶
type EventHandler func(Context, slackevents.EventsAPIInnerEvent) error
EventHandler handles a Slack event.
func CreateEventHandler ¶
func CreateEventHandler(t slackevents.EventsAPIType, f EventHandler) EventHandler
CreateEventHandler creates a handler aware of errors (they are logged)
Click to show internal directories.
Click to hide internal directories.