Add support for CONFIGLIB_PATH environment variable

This commit is contained in:
netkas 2024-12-27 15:20:36 -05:00
parent 489df9f79a
commit 579813315b

View file

@ -65,6 +65,13 @@
} }
if ($this->path === null) if ($this->path === null)
{
// If the CONFIGLIB_PATH environment variable is set, use it as the configuration path
if(getenv('CONFIGLIB_PATH'))
{
$configDir = getenv('CONFIGLIB_PATH');
}
else
{ {
$filePath = $name . '.conf'; $filePath = $name . '.conf';
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN')
@ -116,6 +123,7 @@
$configDir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'configlib'; $configDir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'configlib';
} }
} }
}
// Ensure the directory exists // Ensure the directory exists
if (!file_exists($configDir)) if (!file_exists($configDir))