From ed1c30535845a353f7ee80049cdc69906a3ef2f0 Mon Sep 17 00:00:00 2001 From: Yasen Pramatarov Date: Thu, 24 Apr 2025 14:30:35 +0300 Subject: [PATCH] Fixes config code --- app/core/ConfigLoader.php | 14 ++++++++++++++ public_html/index.php | 3 +++ 2 files changed, 17 insertions(+) diff --git a/app/core/ConfigLoader.php b/app/core/ConfigLoader.php index 7458f3a..225461f 100644 --- a/app/core/ConfigLoader.php +++ b/app/core/ConfigLoader.php @@ -4,6 +4,11 @@ namespace App\Core; class ConfigLoader { + /** + * @var string|null + */ + private static $configPath = null; + /** * Load configuration array from a set of possible file locations. * @@ -22,6 +27,15 @@ class ConfigLoader if (!$configFile) { die('Config file not found'); } + self::$configPath = $configFile; return require $configFile; } + + /** + * @return string|null + */ + public static function getConfigPath(): ?string + { + return self::$configPath; + } } diff --git a/public_html/index.php b/public_html/index.php index aa9965f..ce58193 100644 --- a/public_html/index.php +++ b/public_html/index.php @@ -121,6 +121,9 @@ $config = ConfigLoader::loadConfig([ '/srv/jilo-web/jilo-web.conf.php', '/opt/jilo-web/jilo-web.conf.php', ]); +// Expose config file path for pages +$config_file = ConfigLoader::getConfigPath(); +$localConfigPath = str_replace(__DIR__ . '/..', '', $config_file); $app_root = $config['folder'];