Documentation ¶
Index ¶
- Constants
- func ProvideStorageFor(ctx context.Context, cfg Config) (storage.Blob, error)
- func SetupAMQP(cfg AMQPConfig) (*amqp.Connection, error)
- func SetupTelegram(cfg TelegramConfig) (*tgbotapi.BotAPI, error)
- type AMQPConfig
- type BackendType
- type Config
- type Env
- type RedisConfig
- type SessionBackend
- type StorageConfig
- type TelegramConfig
Constants ¶
View Source
const ( StorageTypeFS = "fs" StorageTypeS3 = "s3" )
Variables ¶
This section is empty.
Functions ¶
func ProvideStorageFor ¶
func SetupAMQP ¶
func SetupAMQP(cfg AMQPConfig) (*amqp.Connection, error)
func SetupTelegram ¶
func SetupTelegram(cfg TelegramConfig) (*tgbotapi.BotAPI, error)
Types ¶
type AMQPConfig ¶
type BackendType ¶
type BackendType string
const ( BackendTypeRedis BackendType = "redis" BackendTypeInMemory BackendType = "in_memory" )
type Config ¶
type Config struct { Addr string `env:"ADDR,default=localhost:8080"` LogLevel string `env:"LOG_LEVEL,default=error"` TelegramUpdatesMaxWorkers int `env:"TELEGRAM_UPDATES_MAX_WORKERS,default=10"` FetchingMaxWorkers int `env:"FETCHING_MAX_WORKERS,default=10"` UploadingMaxWorkers int `env:"UPLOADING_MAX_WORKERS,default=5"` HashingFunc string `env:"FILE_HASHING_FUNC,default=md5"` SessionBackend BackendType `env:"SESSION_BACKEND_TYPE,default=redis"` DB db.Config Redis RedisConfig Telegram TelegramConfig RabbitMQ AMQPConfig Storage StorageConfig }
type Env ¶
type Env struct {
// contains filtered or unexported fields
}
func (Env) AMQP ¶
func (e Env) AMQP() *amqp.Connection
func (Env) SessionBackend ¶
func (e Env) SessionBackend() SessionBackend
type RedisConfig ¶
type SessionBackend ¶
type SessionBackend interface { Get(ctx context.Context, k string) ([]byte, error) Set(ctx context.Context, k string, v []byte) error Delete(ctx context.Context, k string) error }
func ProvideSessionBackendFor ¶
func ProvideSessionBackendFor(cfg Config) (SessionBackend, error)
type StorageConfig ¶
type TelegramConfig ¶
type TelegramConfig struct { ProxySchema string `env:"TELEGRAM_PROXY_SCHEMA,default=http"` ProxyAddr string `env:"TELEGRAM_PROXY_ADDR,default=127.0.0.1:8081"` WebHookURL string `env:"TELEGRAM_WEBHOOK_URL"` WebHookAddr string `env:"TELEGRAM_WEBHOOK_ADDR"` Token string `env:"TELEGRAM_TOKEN"` PollingTimeout int `env:"TELEGRAM_POLLING_TIMEOUT,default=10"` }
Click to show internal directories.
Click to hide internal directories.