downloader/envvars.go

29 lines
1.0 KiB
Go

package main
import (
"text/template"
"time"
"git.milar.in/milarin/envvars/v2"
"git.milar.in/nyaanime/logic"
)
var (
PollRate = envvars.Object("POLL_RATE", 30*time.Minute, time.ParseDuration)
TorrentPath = envvars.String("TORRENT_PATH", "")
DebugAnimeEpisodePattern = envvars.Object(
"DEBUG_ANIME_EPISODE_PATTERN",
template.Must(template.New("anime-episode-filepath-pattern").Parse(`{{.Title.UserPreferred}} episode {{.Episode}}`)),
template.New("anime-episode-filepath-pattern").Parse,
)
TelegramBotToken = envvars.String("TELEGRAM_API_TOKEN", "")
TelegramChatID = envvars.Int64("TELEGRAM_CHAT_ID", 0)
TelegramDownloadMessagePatternStr = logic.EscSeqReplacer.Replace(envvars.String("TELEGRAM_DOWNLOAD_MESSAGE_PATTERN", `Download started\n\n{{.Title.UserPreferred}} episode {{.Episode}}`))
TelegramDownloadMessagePattern = template.Must(template.New("telegram-download-message-pattern").Parse(TelegramDownloadMessagePatternStr))
DownloadAll = envvars.Bool("DOWNLOAD_ALL_ANIMES", false)
)