config

package
v1.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 28, 2019 License: MIT Imports: 4 Imported by: 3

Documentation

Overview

Package config provides some utilities and structs to access configuration loaded via Viper

Index

Constants

View Source
const (
	TokenKey                    = "token"                                  // Slack token, string
	DebugKey                    = "debug"                                  // Debug mode, boolean
	ResponseCacheSizeKey        = "responseCacheSize"                      // Response cache size in number of entries, int
	TimeLocationKey             = "timeLocation"                           // Time Location as understood by time.LoadLocation
	ThreadedRepliesKey          = "replyBehavior.threadedReplies"          // Threaded replies mode (slackscot will respond to all triggering messages using threads), boolean
	BroadcastThreadedRepliesKey = "replyBehavior.broadcastThreadedReplies" // Broadcast threaded replies (slackscot will set broadcast on threaded replies, only applies if threaded replies are enabled), boolean
	PluginsKey                  = "plugins"                                // Root element of the map of string key/values for plugins string
	UserInfoCacheSizeKey        = "userInfoCacheSize"                      // The number of entries to keep in the user info cache, int value. Defaults to no caching (value of 0)
)

Slackscot global configuration keys

Variables

This section is empty.

Functions

func GetTimeLocation

func GetTimeLocation(v *viper.Viper) (timeLoc *time.Location, err error)

GetTimeLocation reads the TimeLocation configuration and maps it to the appropriate time.Location value. Returns an err if the location value is invalid

func NewViperWithDefaults

func NewViperWithDefaults() (v *viper.Viper)

NewViperWithDefaults creates a new viper instance with defaults set on it

Types

type PluginConfig

type PluginConfig = viper.Viper

PluginConfig is a sub-viper instance holding the subtree specific to a named plugin

func GetPluginConfig

func GetPluginConfig(v *viper.Viper, name string) (pluginConfig *PluginConfig, err error)

GetPluginConfig returns the viper sub-tree for a named plugin

type ReplyBehavior

type ReplyBehavior struct {
	ThreadedReplies bool
	Broadcast       bool
}

ReplyBehavior holds flags to define the replying behavior (use threads or not and broadcast replies or not)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL