configure

package
v0.0.0-...-117abf3 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindEnvs

func BindEnvs(config *viper.Viper, iface interface{}, parts ...string)

Types

type Config

type Config struct {
	Level      string `mapstructure:"level" json:"level"`
	ConfigFile string `mapstructure:"config" json:"config"`
	NoHeader   bool   `mapstructure:"noheader" json:"noheader"`
	Mode       Mode   `mapstructure:"mode" json:"mode"`

	K8S struct {
		NodeName string `mapstructure:"node_name" json:"node_name"`
	} `mapstructure:"k8s" json:"k8s"`

	Health struct {
		Bind    string `mapstructure:"bind" json:"bind"`
		Enabled bool   `mapstructure:"enabled" json:"enabled"`
	} `mapstructure:"health" json:"health"`

	Monitoring struct {
		Bind    string     `mapstructure:"bind" json:"bind"`
		Enabled bool       `mapstructure:"enabled" json:"enabled"`
		Labels  []KeyValue `mapstructure:"labels" json:"labels"`
	} `mapstructure:"monitoring" json:"monitoring"`

	Master struct {
		API struct {
			Bind     string `mapstructure:"bind" json:"bind"`
			HttpBind string `mapstructure:"http_bind" json:"http_bind"`
		} `mapstructure:"api" json:"api"`

		Irc struct {
			ChannelLimitPerSlave int    `mapstructure:"channel_limit_per_slave" json:"channel_limit_per_slave"`
			BotAccountID         string `mapstructure:"bot_account_id" json:"bot_account_id"`
		} `mapstructure:"irc" json:"irc"`

		Twitch struct {
			ClientID     string `mapstructure:"client_id" json:"client_id"`
			ClientSecret string `mapstructure:"client_secret" json:"client_secret"`
			RedirectURI  string `mapstructure:"redirect_uri" json:"redirect_uri"`
		} `mapstructure:"twitch" json:"twitch"`

		K8S struct {
			Enabled        bool   `mapstructure:"enabled" json:"enabled"`
			Namespace      string `mapstructure:"namespace" json:"namespace"`
			InCluster      bool   `mapstructure:"in_cluster" json:"in_cluster"`
			ConfigPath     string `mapstructure:"config_path" json:"config_path"`
			SatefulsetName string `mapstructure:"statefulset_name" json:"statefulset_name"`
		} `mapstructure:"k8s" json:"k8s"`

		Mongo struct {
			URI      string `mapstructure:"uri" json:"uri"`
			Database string `mapstructure:"database" json:"database"`
			Direct   bool   `mapstructure:"direct" bson:"direct"`
		} `mapstructure:"mongo" json:"mongo"`
	} `mapstructure:"master" json:"master"`

	Slave struct {
		API struct {
			GrpcDial string `mapstructure:"grpc_dial" json:"grpc_dial"`
		} `mapstructure:"api" json:"api"`
		IRC struct {
			ChannelLimitPerConn int `mapstructure:"channel_limit_per_conn" json:"channel_limit_per_conn"`
		} `mapstructure:"irc" json:"irc"`
	} `mapstructure:"slave" json:"slave"`

	Redis struct {
		MasterName string   `mapstructure:"master_name" json:"master_name"`
		Username   string   `mapstructure:"username" json:"username"`
		Password   string   `mapstructure:"password" json:"password"`
		Database   int      `mapstructure:"database" json:"database"`
		Addresses  []string `mapstructure:"addresses" json:"addresses"`
		Sentinel   bool     `mapstructure:"sentinel" json:"sentinel"`
	} `mapstructure:"redis" json:"redis"`
}

func New

func New() *Config

func (Config) IsMaster

func (c Config) IsMaster() bool

func (Config) IsSlave

func (c Config) IsSlave() bool

type KeyValue

type KeyValue struct {
	Key   string `mapstructure:"key" json:"key"`
	Value string `mapstructure:"value" json:"value"`
}

type Mode

type Mode string
const (
	ModeMaster Mode = "master"
	ModeSlave  Mode = "slave"
)

Jump to

Keyboard shortcuts

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