downloader/envvars.go
2023-01-15 20:59:54 +01:00

30 lines
1021 B
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,
)
TelegramDownloadMessagePatternStr = logic.EscSeqReplacer.Replace(envvars.String("TELEGRAM_DOWNLOAD_MESSAGE_PATTERN", `Download started\n{{.Anime.Title.UserPreferred}}{{.Episode}}`))
TelegramDownloadMessagePattern = template.Must(template.New("telegram-download-message-pattern").Parse(TelegramDownloadMessagePatternStr))
DownloadAll = envvars.Bool("DOWNLOAD_ALL_ANIMES", false)
TelegramBotToken = envvars.String("TELEGRAM_API_TOKEN", "")
TelegramChatID = envvars.Int64("TELEGRAM_CHAT_ID", 0)
)