config

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package config manages loading config variables from environment

Index

Constants

View Source
const VersionString = "v1.6.0"

VersionString current tagged version for application

Variables

View Source
var TokenPath = "discord.token"

Functions

func LoadConfig added in v1.2.0

func LoadConfig() error

func SetConfigDefaults added in v1.1.0

func SetConfigDefaults()

Types

type App added in v1.2.0

type App struct {
	Quotes             quotes.QuoteEngine
	DNotationParser    *parser.DNotationParser
	ThresholdRoller    *roller.ThresholdRoller
	ConnPool           model.DbPool
	Stats              *stats.Stats
	CursedChannelCache cache.ChannelCache
	CursedWordCache    cache.StringListCache
}

App represents the current app components & state

func LoadApp added in v1.2.0

func LoadApp() (*App, error)

LoadApp loads default app state

type Config

type Config struct {
	Discord DiscordConfig
	Metrics MetricsConfig
	Db      DbConfig
}
var GlobalConfig Config

type DbConfig added in v1.2.0

type DbConfig struct {
	Connection string
}

type DiscordConfig added in v1.2.0

type DiscordConfig struct {
	AppId                   string         `mapstructure:"app_id"`
	Token                   string         `mapstructure:"token"`
	ShardId                 uint64         `mapstructure:"shard_id"`
	ShardCount              uint64         `mapstructure:"shard_count"`
	InsomniacIds            []string       `mapstructure:"insomniac_ids"`
	InsomniacRoles          []string       `mapstructure:"insomniac_roles"`
	ListenConfigs           []ListenConfig `mapstructure:"listen_configs"`
	DefaultWeatherLocations []string       `mapstructure:"default_weather_locations"`
	ListenChannelSet        map[string]*ListenConfig
}

type ListenConfig added in v1.2.0

type ListenConfig struct {
	GuildId         string `mapstructure:"guild_id"`
	ReportChannelId string `mapstructure:"report_channel_id"`
	StartTime       string `mapstructure:"start_time"` // Time in 24hr format UTC to run
}

type MetricsConfig added in v1.2.0

type MetricsConfig struct {
	HealthcheckEnabled bool   `mapstructure:"healthcheck_enabled"`
	MetricsEnabled     bool   `mapstructure:"metrics_enabled"`
	Appname            string `mapstructure:"appname"`
	LogLevel           string `mapstructure:"log_level"`
	MetricsPort        uint64 `mapstructure:"port"`
}

Jump to

Keyboard shortcuts

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