From abd64651905bf3678c1c181ed80179c128d38df4 Mon Sep 17 00:00:00 2001 From: nervo Date: Wed, 1 Apr 2020 22:02:34 +0200 Subject: [PATCH 1/2] Allow constants values to be overridden by environment variables --- htdocs/core/class/conf.class.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 9a804256dac..5c2a9d9d4fb 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -171,6 +171,13 @@ class Conf $value = $objp->value; if ($key) { + // Allow constants values to be overridden by environment variables + if (isset($_SERVER['DOLIBARR_' . $key])) { + $value=$_SERVER['DOLIBARR_' . $key]; + } elseif (isset($_ENV['DOLIBARR_' . $key])) { + $value=$_ENV['DOLIBARR_' . $key]; + } + //if (! defined("$key")) define("$key", $value); // In some cases, the constant might be already forced (Example: SYSLOG_HANDLERS during install) $this->global->$key = $value; From cf3615aee386af04e0b7c3e19433f1113a4ab061 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 1 Apr 2020 20:11:18 +0000 Subject: [PATCH 2/2] Fixing style errors. --- htdocs/core/class/conf.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 5c2a9d9d4fb..38538f12f93 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -177,7 +177,7 @@ class Conf } elseif (isset($_ENV['DOLIBARR_' . $key])) { $value=$_ENV['DOLIBARR_' . $key]; } - + //if (! defined("$key")) define("$key", $value); // In some cases, the constant might be already forced (Example: SYSLOG_HANDLERS during install) $this->global->$key = $value;