config

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2023 License: GPL-3.0 Imports: 16 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:"-"`
	Store       Store           `fig:"store" yaml:"store"`
	Timezone    string          `fig:"timezone" yaml:"timezone"`
	Description string          `fig:"description" yaml:"description"`
	Calendar    string          `fig:"calendar" yaml:"calendar"`
	Logger      Logger          `fig:"logger" yaml:"logger"`
	Telegram    Telegram        `fig:"telegram" yaml:"telegram"`
	Location    Location        `fig:"location" yaml:"location"`
	Youtube     YouTube         `fig:"youtube" yaml:"youtube"`
	Pix         Pix             `fig:"pix" yaml:"pix"`
	Cron        Cron            `fig:"cron" yaml:"cron"`
	Covers      sources.Sources `fig:"covers" yaml:"covers"`
}

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 CommandMapper

type CommandMapper struct {
	Endpoints []string `fig:"endpoints" yaml:"endpoints"`
	Handler   string   `fig:"handler" yaml:"handler"`
}

type Cron

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

type Location

type Location struct {
	Title           string  `fig:"title" yaml:"title"`
	Address         string  `fig:"address" yaml:"address"`
	Latitude        float32 `fig:"latitude" yaml:"latitude"`
	Longitude       float32 `fig:"longitude" yaml:"longitude"`
	FoursquareID    string  `fig:"foursquare_id" yaml:"foursquare_id"`
	FoursquareType  string  `fig:"foursquare_type" yaml:"foursquare_type"`
	GooglePlaceID   string  `fig:"google_place_id" yaml:"google_place_id"`
	GooglePlaceType string  `fig:"google_place_type" yaml:"google_place_type"`
}

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 MenuMapper struct {
	Text    string `fig:"text" yaml:"text"`
	Handler string `fig:"handler" yaml:"handler"`
}

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 SetOfCommand

type SetOfCommand struct {
	Text        string `fig:"text" yaml:"text"`
	Description string `fig:"description" yaml:"description"`
}

type Store

type Store struct {
	Path string `fig:"path" yaml:"path"  default:"/peristera.d/store"`
}

type Telegram

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

type TelegramCommands

type TelegramCommands struct {
	SetOf   []SetOfCommand  `fig:"set_of" yaml:"set_of"`
	Mappers []CommandMapper `fig:"mappers" yaml:"mappers"`
	Menu    []MenuMapper    `fig:"menu" yaml:"menu"`
}

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