app

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2019 License: Unlicense Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLogger

func GetLogger(debug bool) (*zap.Logger, error)

Types

type Application

type Application struct {
	Bot           *bot.Bot
	Config        *Config
	Ctx           context.Context
	CtxCancel     context.CancelFunc
	Error         chan error
	Logger        *zap.Logger
	MongoDB       *mongo.Client
	RatesProvider ratesTypes.Provider
	Repository    *repository.Repository
	WaitGroup     *sync.WaitGroup
}

func New

func New() (*Application, error)

func (*Application) Close

func (app *Application) Close()

func (*Application) Run

func (app *Application) Run()

func (*Application) Stop

func (app *Application) Stop()

type Config

type Config struct {
	Debug                     bool   `env:"DEBUG" envDefault:"false"`
	DebugTelegramAPI          bool   `env:"DEBUG_TELEGRAM_API" envDefault:"false"`
	MongoDbURI                string `env:"MONGO_DB_URI" envDefault:"mongodb://localhost:27017"`
	MongoDbDatabase           string `env:"MONGO_DB_DATABASE" envDefault:"my-savings-telegram-bot"`
	RatesProvider             string `env:"RATES_PROVIDER" envDefault:"fixerio"`
	RatesProviderOptions      string `` /* 230-byte string literal not displayed */
	RatesProviderUpdatePeriod int    `env:"RATES_RPOVIDER_UPDATE_PERIOD" envDefault:"3600"`
	TelegramAPIToken          string `env:"TELEGRAM_API_TOKEN" envDefault:""`
	TelegramAPIUpdatesTimeout int    `env:"TELEGRAM_API_UPDATES_TIMEOUT" envDfault:"60"`
}

func GetConfig

func GetConfig() (config *Config, err error)

Jump to

Keyboard shortcuts

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