config

package
v1.49.0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2021 License: MIT Imports: 4 Imported by: 1

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
	MaxAgeHandledMessages       = "maxAgeHandledMessages"                  // The maximum age of messages before they are ignored (applicable for message updates)
	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

View Source
const (
	MessageProcessingPartitionCount       = "advanced.messageProcessingPartitionCount"       // The number of partitions used to process messages concurrently. Must be a power of two. A higher number means less chance (but higher resource usage) of delays in processing of different messages
	MessageProcessingBufferedMessageCount = "advanced.messageProcessingBufferedMessageCount" // The channel capacity of each message processing partition. A higher number means less chance of a given partition with a lot of slow messages to handle causing a blockage of processing on other partitions
)

Advanced configuration keys, only change if you really know what you're doing and have reviewed the internals

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 LayerConfigWithDefaults added in v1.39.0

func LayerConfigWithDefaults(v *viper.Viper) (layered *viper.Viper)

LayerConfigWithDefaults takes a loaded user configuration and layers the defaults under it

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