config

package
v0.4.7 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppConfig

type AppConfig struct {
	DiscordConfig *DiscordConfig
	BotToken      string `mapstructure:"botToken"`
	BotName       string `mapstructure:"botName"`
	AppId         int64  `mapstructure:"appId"`
	Features      []FeatureConfig
	LogLevel      string         `mapstructure:"logLevel"`
	DBConfig      BloopyDBConfig `mapstructure:"db"`
	FeatureMap    map[string]FeatureConfig
}

App Config

func GetConfig

func GetConfig() *AppConfig

func (*AppConfig) GetConfiguredFeatureNames

func (myConfig *AppConfig) GetConfiguredFeatureNames() []string

deprecated. Refactor to use FeatureMap Keys

func (*AppConfig) GetFeatureConfig

func (myConfig *AppConfig) GetFeatureConfig(name string) (FeatureConfig, error)

Deprecated until the map version works

func (*AppConfig) GetFeatureConfigViaMap

func (myConfig *AppConfig) GetFeatureConfigViaMap(name string) (FeatureConfig, error)

Gets FeatureConfig for Key if exists

type AppConfigLoader

type AppConfigLoader struct {
	// contains filtered or unexported fields
}

func GetAppConfigLoader

func GetAppConfigLoader() *AppConfigLoader

func NewAppConfigLoader

func NewAppConfigLoader(AppConfig *AppConfig) *AppConfigLoader

func (*AppConfigLoader) GetConfig

func (c *AppConfigLoader) GetConfig() *AppConfig

func (*AppConfigLoader) GetRevision

func (c *AppConfigLoader) GetRevision() int

func (*AppConfigLoader) UpdateConfig

func (c *AppConfigLoader) UpdateConfig(AppConfig *AppConfig)

type BloopyDBConfig

type BloopyDBConfig struct {
	Name     string `mapstructure:"name"`
	Type     string `mapstructure:"type"`
	Host     string `mapstructure:"host"`
	Port     string `mapstructure:"port"`
	User     string `mapstructure:"user"`
	Password string `mapstructure:"password"`
}

type ConfigLoader

type ConfigLoader interface {
	GetConfig() interface{}
	UpdateConfig()
	GetLastUpdated() time.Time
	GetRevision() int
}

type DiscordConfig

type DiscordConfig struct {
	BotToken string `mapstructure:"token"`
	BotName  string `mapstructure:"name"`
	AppId    int64  `mapstructure:"appId"`
}

type FeatureConfig

type FeatureConfig struct {
	Name    string `mapstructure:"name"`
	Enabled bool   `mapstructure:"enabled"`
	Data    map[string]string
}

Feature Specific Config

Jump to

Keyboard shortcuts

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