mirror of
https://github.com/grocy/grocy.git
synced 2025-04-30 10:05:45 +00:00
Make config.php settings also available as environment variables (closes #118)
This commit is contained in:
parent
04dacacd73
commit
bdcd176f81
@ -1,5 +1,19 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
# Settings can also be overwritten in two ways
|
||||||
|
#
|
||||||
|
# First priority
|
||||||
|
# A .txt file with the same name as the setting in /data/settingoverrides
|
||||||
|
# the content of the file is used as the setting value
|
||||||
|
#
|
||||||
|
# Second priority
|
||||||
|
# An environment variable with the same name as the setting and prefix "GROCY_"
|
||||||
|
# so for example "GROCY_BASE_URL"
|
||||||
|
#
|
||||||
|
# Third priority
|
||||||
|
# The settings defined here below
|
||||||
|
|
||||||
|
|
||||||
# Either "production", "dev" or "prerelease"
|
# Either "production", "dev" or "prerelease"
|
||||||
Setting('MODE', 'production');
|
Setting('MODE', 'production');
|
||||||
|
|
||||||
|
@ -138,6 +138,10 @@ function Setting(string $name, $value)
|
|||||||
{
|
{
|
||||||
define('GROCY_' . $name, file_get_contents($settingOverrideFile));
|
define('GROCY_' . $name, file_get_contents($settingOverrideFile));
|
||||||
}
|
}
|
||||||
|
elseif (getenv('GROCY_' . $name) !== false) // An environment variable with the same name and prefix GROCY_ overwrites the given setting
|
||||||
|
{
|
||||||
|
define('GROCY_' . $name, getenv('GROCY_' . $name));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
define('GROCY_' . $name, $value);
|
define('GROCY_' . $name, $value);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user