feat(schedule)!: move schedule parser, downloader, and updater to external library

This can be used to support more schedule formats in the future.
This commit is contained in:
2025-09-02 08:54:22 +04:00
parent 7c973bfda0
commit 5e39fc9acc
37 changed files with 1364 additions and 1271 deletions

View File

@@ -1,11 +1,15 @@
pub mod schedule;
pub mod telegram;
pub mod vk_id;
#[cfg(not(test))]
pub mod yandex_cloud;
pub use self::schedule::ScheduleEnvData;
pub use self::telegram::TelegramEnvData;
pub use self::vk_id::VkIdEnvData;
#[cfg(not(test))]
pub use self::yandex_cloud::YandexCloudEnvData;
#[derive(Default)]
@@ -13,5 +17,7 @@ pub struct AppEnv {
pub schedule: ScheduleEnvData,
pub telegram: TelegramEnvData,
pub vk_id: VkIdEnvData,
#[cfg(not(test))]
pub yandex_cloud: YandexCloudEnvData,
}

View File

@@ -2,6 +2,7 @@ use std::env;
#[derive(Clone)]
pub struct ScheduleEnvData {
#[cfg(not(test))]
pub url: Option<String>,
pub auto_update: bool,
}
@@ -9,6 +10,7 @@ pub struct ScheduleEnvData {
impl Default for ScheduleEnvData {
fn default() -> Self {
Self {
#[cfg(not(test))]
url: env::var("SCHEDULE_INIT_URL").ok(),
auto_update: !env::var("SCHEDULE_DISABLE_AUTO_UPDATE")
.is_ok_and(|v| v.eq("1") || v.eq("true")),