configs

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	App struct {
		Env      Environment `yaml:"env"`
		PoolSize int         `yaml:"pool_size"`
		Log      struct {
			LogLevel        string   `yaml:"level"`
			PrettyPrint     bool     `yaml:"pretty_print"`
			SentryDSN       string   `yaml:"sentry_dsn"`
			SentryLogLevels []string `yaml:"sentry_log_levels"`
		} `yaml:"log"`
	} `yaml:"app"`

	API struct {
		ServeAddress string `yaml:"address"`
		AccessToken  string `yaml:"access_token"`
	} `yaml:"api"`

	Monitoring struct {
		IsEnabled bool   `yaml:"enable"`
		Path      string `yaml:"path"`
		Password  string `yaml:"password"`
	} `yaml:"monitoring"`

	Notifier struct {
		Squadcast struct {
			IsEnabled bool `yaml:"enable"`
			Teams     map[string]string
		} `yaml:"squadcast"`
		Telegram struct {
			IsEnabled bool                      `yaml:"enable"`
			Host      string                    `yaml:"host"`
			Token     string                    `yaml:"token"`
			Teams     map[string][]TelegramTeam `yaml:"teams"`
		} `yaml:"telegram"`
		Slack struct {
			IsEnabled bool `yaml:"enable"`
			Teams     map[string]string
		} `yaml:"slack"`
		Custom struct {
			IsEnabled bool `yaml:"enable"`
			Teams     map[string]string
		} `yaml:"custom"`
	}

	Version string
}

Config is the struct that holds all the configuration of the application

func Load

func Load(configPath string) (*Config, error)

Load will loads the configuration from the given path

type Environment

type Environment string

Environment is a type for application environment

const (
	// Testing is the environment for testing
	Testing Environment = "testing"
	// Production is the environment for production
	Production Environment = "production"
	// Staging is the environment for staging
	Staging Environment = "staging"
	// Local is the environment for local
	Local Environment = "local"
)

func (Environment) IsLocal

func (e Environment) IsLocal() bool

IsLocal returns true if the environment is local

func (Environment) IsProduction

func (e Environment) IsProduction() bool

IsProduction returns true if the environment is production

func (Environment) IsStaging

func (e Environment) IsStaging() bool

IsStaging returns true if the environment is staging

func (Environment) IsTesting

func (e Environment) IsTesting() bool

IsTesting returns true if the environment is testing

type TelegramTeam

type TelegramTeam struct {
	Chat  string `yaml:"chat"`
	Topic string `yaml:"topic"`
}

TelegramTeam is a struct for Telegram team configuration

Jump to

Keyboard shortcuts

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