allow configurable base url

This commit is contained in:
2025-07-20 12:32:23 +02:00
parent bcbdf60d73
commit 46ccdd89ff
7 changed files with 19 additions and 4 deletions
@@ -22,6 +22,8 @@ public class Main {
public static final Logger LOGGER = LoggerFactory.getLogger("Inviter");
public static String baseUrl;
private static JDA jda;
private static DiscordInviteManager discordInviteManager;
private static ApiServer apiServer;
@@ -31,6 +33,15 @@ public class Main {
String token = System.getenv("DISCORD_TOKEN");
String baseUrlRaw = System.getenv("BASE_URL");
if (baseUrlRaw == null || baseUrlRaw.isEmpty()) {
baseUrl = "https://example.com";
LOGGER.warn("BASE_URL environment variable is not set. Using default: {}", baseUrl);
} else {
if (baseUrlRaw.endsWith("/")) baseUrlRaw = baseUrlRaw.substring(0, baseUrlRaw.length() - 1);
baseUrl = baseUrlRaw;
}
if (token == null || token.isEmpty()) {
LOGGER.error("Discord token is not set. Please set the DISCORD_TOKEN environment variable.");
System.exit(1);