Updated to latest installer with support for env vars

This commit is contained in:
Alejandro Celaya
2022-01-15 11:34:17 +01:00
parent 0d37eb65c9
commit c6f16b0558
6 changed files with 45 additions and 13 deletions

View File

@@ -13,9 +13,13 @@ use PUGX\Shortid\Factory as ShortIdFactory;
use Shlinkio\Shlink\Common\Util\DateRange;
use function Functional\reduce_left;
use function implode;
use function is_array;
use function is_scalar;
use function print_r;
use function putenv;
use function Shlinkio\Shlink\Common\buildDateRange;
use function Shlinkio\Shlink\Config\env;
use function sprintf;
use function str_repeat;
@@ -116,3 +120,18 @@ function fieldWithUtf8Charset(FieldBuilder $field, array $emConfig, string $coll
default => $field,
};
}
function putNotYetDefinedEnv(string $key, mixed $value): void
{
$isArray = is_array($value);
if (!($isArray || is_scalar($value)) || env($key) !== null) {
return;
}
$normalizedValue = $isArray ? implode(',', $value) : match ($value) {
true => 'true',
false => 'false',
default => $value,
};
putenv(sprintf('%s=%s', $key, $normalizedValue));
}