From 4c62fde11f26beb49687ff755817567ecbf74a25 Mon Sep 17 00:00:00 2001 From: tiennm99 Date: Fri, 7 Nov 2025 21:08:05 +0700 Subject: [PATCH] Replace SOURCE_VERSION with SOURCE_COMMIT in config Renamed the SOURCE_VERSION constant to SOURCE_COMMIT in Config.java and updated its usage in Main.java. The environment variable and related references now consistently use SOURCE_COMMIT to better reflect the tracked value. --- src/main/java/com/miti99/storescraperbot/Main.java | 4 ++-- .../java/com/miti99/storescraperbot/config/Config.java | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/miti99/storescraperbot/Main.java b/src/main/java/com/miti99/storescraperbot/Main.java index 5c5fb41..d97a0af 100644 --- a/src/main/java/com/miti99/storescraperbot/Main.java +++ b/src/main/java/com/miti99/storescraperbot/Main.java @@ -1,7 +1,7 @@ package com.miti99.storescraperbot; import static com.miti99.storescraperbot.config.Config.CREATOR_ID; -import static com.miti99.storescraperbot.config.Config.SOURCE_VERSION; +import static com.miti99.storescraperbot.config.Config.SOURCE_COMMIT; import com.miti99.storescraperbot.bot.StoreScrapeBot; import com.miti99.storescraperbot.bot.StoreScrapeBotTelegramClient; @@ -20,7 +20,7 @@ public class Main { botsApplication.registerBot(Config.TELEGRAM_BOT_TOKEN, StoreScrapeBot.INSTANCE); log.info("StoreScrapeBot successfully started!"); StoreScrapeBotTelegramClient.INSTANCE.sendMessage( - CREATOR_ID, "Bot started! Version %s".formatted(SOURCE_VERSION)); + CREATOR_ID, "Bot started! Version %s".formatted(SOURCE_COMMIT)); Thread.currentThread().join(); } catch (Exception e) { log.error("Error while running bot", e); diff --git a/src/main/java/com/miti99/storescraperbot/config/Config.java b/src/main/java/com/miti99/storescraperbot/config/Config.java index 219e94c..48118fa 100644 --- a/src/main/java/com/miti99/storescraperbot/config/Config.java +++ b/src/main/java/com/miti99/storescraperbot/config/Config.java @@ -6,7 +6,6 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Optional; -import java.util.Set; import java.util.stream.Collectors; public class Config { @@ -32,8 +31,8 @@ public class Config { .orElse(Collections.emptyList()); public static final long CREATOR_ID = ADMIN_IDS.getFirst(); - public static final String SOURCE_VERSION = - Strings.isNullOrEmpty(System.getenv("SOURCE_VERSION")) + public static final String SOURCE_COMMIT = + Strings.isNullOrEmpty(System.getenv("SOURCE_COMMIT")) ? "unknown" - : System.getenv("SOURCE_VERSION"); + : System.getenv("SOURCE_COMMIT"); }