fix(mcp): load dotenv relative to project root
This commit is contained in:
+3
-2
@@ -20,14 +20,15 @@ from dotenv import dotenv_values, load_dotenv
|
|||||||
|
|
||||||
import gitea_config
|
import gitea_config
|
||||||
|
|
||||||
|
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
|
||||||
# Load standard .env if present
|
# Load standard .env if present
|
||||||
load_dotenv()
|
load_dotenv(os.path.join(PROJECT_ROOT, ".env"))
|
||||||
|
|
||||||
# Dictionary to store configurations parsed dynamically from .env.* files
|
# Dictionary to store configurations parsed dynamically from .env.* files
|
||||||
DYNAMIC_CONFIGS = {}
|
DYNAMIC_CONFIGS = {}
|
||||||
|
|
||||||
# Scan all files starting with .env in the project root to load multiple configurations
|
# Scan all files starting with .env in the project root to load multiple configurations
|
||||||
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
|
|
||||||
for env_path in glob.glob(os.path.join(PROJECT_ROOT, ".env*")):
|
for env_path in glob.glob(os.path.join(PROJECT_ROOT, ".env*")):
|
||||||
# Skip directories and the example template
|
# Skip directories and the example template
|
||||||
if os.path.basename(env_path) == ".env.example":
|
if os.path.basename(env_path) == ".env.example":
|
||||||
|
|||||||
Reference in New Issue
Block a user