From cc3eca1dc53bd0328cecefa0a9308bee47fd77f4 Mon Sep 17 00:00:00 2001 From: wrvsrx <42770726+wrvsrx@users.noreply.github.com> Date: Sun, 21 Jul 2024 16:24:53 +0800 Subject: [PATCH] Support config `PROJECT_PATH_CONFIG` and `PROJECT_PATH_SPECIFIC` via environment variables (#1270) --- Core/Frameworks/Flake/Framework.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/Core/Frameworks/Flake/Framework.php b/Core/Frameworks/Flake/Framework.php index 579e25a..347ad67 100644 --- a/Core/Frameworks/Flake/Framework.php +++ b/Core/Frameworks/Flake/Framework.php @@ -163,11 +163,25 @@ class Framework extends \Flake\Core\Framework { define("PROJECT_PATH_CORE", PROJECT_PATH_ROOT . "Core/"); define("PROJECT_PATH_CORERESOURCES", PROJECT_PATH_CORE . "Resources/"); - define("PROJECT_PATH_SPECIFIC", PROJECT_PATH_ROOT . "Specific/"); - define("PROJECT_PATH_CONFIG", PROJECT_PATH_ROOT . "config/"); define("PROJECT_PATH_FRAMEWORKS", PROJECT_PATH_CORE . "Frameworks/"); define("PROJECT_PATH_WWWROOT", PROJECT_PATH_CORE . "WWWRoot/"); + // set PROJECT_PATH_CONFIG from BAIKAL_PATH_CONFIG + $baikalPathConfig = getenv('BAIKAL_PATH_CONFIG'); + if ($baikalPathConfig !== false) { + define("PROJECT_PATH_CONFIG", $baikalPathConfig); + } else { + define("PROJECT_PATH_CONFIG", PROJECT_PATH_ROOT . "config/"); + } + + // set PROJECT_PATH_SPECIFIC from BAIKAL_PATH_CONFIG + $baikalPathConfig = getenv('BAIKAL_PATH_SPECIFIC'); + if ($baikalPathConfig !== false) { + define("PROJECT_PATH_SPECIFIC", $baikalPathConfig); + } else { + define("PROJECT_PATH_SPECIFIC", PROJECT_PATH_ROOT . "Specific/"); + } + require_once PROJECT_PATH_CORE . "Distrib.php"; define("PROJECT_PATH_DOCUMENTROOT", PROJECT_PATH_ROOT . "html/");