23 lines
488 B
PHP
23 lines
488 B
PHP
|
#!/usr/bin/env php
|
||
|
<?php
|
||
|
|
||
|
echo "Adapting ENV_DIR..." . PHP_EOL;
|
||
|
|
||
|
$path = '/etc/php7/php-fpm.d/www.conf';
|
||
|
$env = "ENV_DIR";
|
||
|
|
||
|
$fileContent = file_get_contents($path);
|
||
|
$fileContent = preg_replace("/%%%" . strtoupper($env) . "%%%/", env($env, "/var/www/html/application/config"), $fileContent);
|
||
|
file_put_contents($path, $fileContent);
|
||
|
|
||
|
function env($name, $default = null)
|
||
|
{
|
||
|
$v = getenv($name) ?: $default;
|
||
|
|
||
|
if ($v === null) {
|
||
|
return "''";
|
||
|
}
|
||
|
|
||
|
return "'" . $v . "'";
|
||
|
}
|