feat: Basic polling

This commit is contained in:
2025-01-17 00:08:57 +03:00
commit 96ea6d6033
10 changed files with 174 additions and 0 deletions

37
internal/config/env.go Normal file
View File

@ -0,0 +1,37 @@
package config
import (
"log"
"os"
"github.com/joho/godotenv"
)
type config struct {
TelegramBotToken string
Schedule struct {
BaseUrl string
FacultyId string
GroupId string
StartDate string
}
FlagfilePath string
CronPattern string
}
var AppConfig config
func init() {
err := godotenv.Load()
if err != nil {
log.Fatal("Error loading .env file")
}
AppConfig.FlagfilePath = os.Getenv("SCHEDULE_FLAG_PATH")
AppConfig.Schedule.BaseUrl = os.Getenv("SCHEDULE_BASE_URL")
AppConfig.Schedule.FacultyId = os.Getenv("SCHEDULE_FACULTY_ID")
AppConfig.Schedule.GroupId = os.Getenv("SCHEDULE_GROUP_ID")
AppConfig.Schedule.StartDate = os.Getenv("SCHEDULE_START_DATE")
AppConfig.TelegramBotToken = os.Getenv("SCHEDULE_TELEGRAM_TOKEN")
AppConfig.CronPattern = os.Getenv("SCHEDULE_CRON_PATTERN")
}