new: dev: initialize the GTK client #11
This commit is contained in:
30
gtk-client/mineseeker/config.py
Normal file
30
gtk-client/mineseeker/config.py
Normal file
@@ -0,0 +1,30 @@
|
||||
"""
|
||||
This file is part of the SplendidBear Websites' projects.
|
||||
|
||||
Copyright (c) 2026 @ www.splendidbear.org
|
||||
|
||||
For the full copyright and license information, please view the LICENSE
|
||||
file that was distributed with this source code.
|
||||
"""
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
from dotenv import load_dotenv
|
||||
|
||||
# Load .env from the gtk-client/ directory (parent of this package)
|
||||
_env_path = Path(__file__).parent.parent / ".env"
|
||||
load_dotenv(dotenv_path=_env_path)
|
||||
|
||||
BASE_URL: str = os.environ.get("MINESEEKER_BASE_URL", "").rstrip("/")
|
||||
MERCURE_URL: str = os.environ.get("MINESEEKER_MERCURE_URL", "").rstrip("/")
|
||||
|
||||
if not BASE_URL:
|
||||
raise EnvironmentError(
|
||||
"MINESEEKER_BASE_URL is not set. "
|
||||
"Copy gtk-client/.env.example to gtk-client/.env and fill in the values."
|
||||
)
|
||||
|
||||
if not MERCURE_URL:
|
||||
# Fall back to <BASE_URL>/.well-known/mercure if not explicitly set
|
||||
MERCURE_URL = f"{BASE_URL}/.well-known/mercure"
|
||||
Reference in New Issue
Block a user