config

package
v0.2.0-beta Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2022 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFailToLoadConfig     = errors.System(nil, "fail to load config", "CONF:001")
	ErrFailEnsureConfig     = errors.System(nil, "fail to ensure config", "CONF:002")
	ConfigFileWasCreated    = errors.Business("a new config file was created (%s)", "CONF:003")
	ErrMissingTelegramToken = errors.System(nil, "missing telegram token", "CONF:004")
	ErrMissingYoutubeToken  = errors.System(nil, "missing youtube token", "CONF:005")
)

Functions

func BuildDate

func BuildDate() string

func Commit

func Commit() string

func Hostname

func Hostname() string

func Version

func Version() string

func VersionVerbose

func VersionVerbose() string

Types

type AppConfig

type AppConfig struct {
	Debug       bool     `fig:"-" yaml:"-"`
	Timezone    string   `fig:"timezone" yaml:"timezone"`
	Description string   `fig:"description" yaml:"description"`
	Logger      Logger   `fig:"logger" yaml:"logger"`
	Telegram    Telegram `fig:"telegram" yaml:"telegram"`
	Youtube     YouTube  `fig:"youtube" yaml:"youtube"`
	Pix         Pix      `fig:"pix" yaml:"pix"`
	Cron        Cron     `fig:"cron" yaml:"cron"`
}

func Ctx

func Ctx(ctx context.Context) *AppConfig

func Load

func Load(file string) (AppConfig, error)

func (AppConfig) Tags

func (c AppConfig) Tags() map[string]interface{}

func (*AppConfig) WithContext

func (c *AppConfig) WithContext(ctx context.Context) context.Context

type Channel

type Channel struct {
	Name string `fig:"name" yaml:"name"`
	ID   string `fig:"id" yaml:"id"`
	URL  string `fig:"url" yaml:"url"`
}

func (Channel) GetURL

func (c Channel) GetURL() string

type Cron

type Cron struct {
	LastUpdates []string `fig:"last_updates" yaml:"last_updates"`
}

type Logger

type Logger struct {
	Level  string `fig:"level" yaml:"level" default:"info"`
	Format string `fig:"format" yaml:"format" default:"text"`
}

func (Logger) Debug

func (l Logger) Debug(level string) bool

type Pix

type Pix struct {
	Key         string `fig:"key" yaml:"key"`
	Description string `fig:"description" yaml:"description"`
	QRCode      QRCode `fig:"qrcode" yaml:"qrcode"`
}

type QRCode

type QRCode string

func (QRCode) NewBuffer

func (q QRCode) NewBuffer() (io.Reader, error)

type Telegram

type Telegram struct {
	Token     string  `fig:"token" yaml:"token"`
	Broadcast []int64 `fig:"broadcast" yaml:"broadcast"`
	Admins    []int64 `fig:"admins" yaml:"admins"`
}

type YouTube

type YouTube struct {
	Token    string    `fig:"token" yaml:"token"`
	Channels []Channel `fig:"channels" yaml:"channels"`
}

Jump to

Keyboard shortcuts

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