From 431f93d2863babe3362a765507945cbfe987cd05 Mon Sep 17 00:00:00 2001 From: Botond Hende Date: Sun, 5 Apr 2026 12:19:18 +0200 Subject: make generating all subdomains for local testing functional --- config.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'config.py') diff --git a/config.py b/config.py index d8bdd7d..a86475d 100644 --- a/config.py +++ b/config.py @@ -6,6 +6,8 @@ class Config: __DIR = os.path.dirname(__file__) ASSETS_IMPORT_PATH = "/assets" ASSETS_IMPORT_PATH_STATIC = "https://static.wazul.moe" + MAIN_ROOT_URL = "https://wazul.moe" + GIT_ROOT_URL = "https://git.wazul.moe" RSS_FILE_NAME = "feed.xml" TIMEZONE = datetime.timezone(datetime.timedelta(hours=2)) @@ -40,3 +42,18 @@ class Config: CODENAMES_ROOT_URL = "https://codenames.wazul.moe" CODENAMES_ASSETS_SOURCE_DIR = os.path.join(__DIR, "codenames/assets") + + # HELPER FUNCTIONS + @staticmethod + def change_url_to_local(url: str) -> str: + return url.replace("https://", "http://").replace("wazul.moe", "localhost") + + @staticmethod + def change_config_to_local(): + Config.ASSETS_IMPORT_PATH_STATIC = Config.change_url_to_local(Config.ASSETS_IMPORT_PATH_STATIC) + Config.MAIN_ROOT_URL = Config.change_url_to_local(Config.MAIN_ROOT_URL) + Config.GIT_ROOT_URL = Config.change_url_to_local(Config.GIT_ROOT_URL) + Config.BLOG_ROOT_URL = Config.change_url_to_local(Config.BLOG_ROOT_URL) + Config.COMIC_ROOT_URL = Config.change_url_to_local(Config.COMIC_ROOT_URL) + Config.CODENAMES_ROOT_URL = Config.change_url_to_local(Config.CODENAMES_ROOT_URL) + -- cgit v1.2.3-70-g09d2