New environment variable: AUDIO_BITRATE

Refactor environment variables code
This commit is contained in:
Pierre Rudloff 2018-01-06 18:03:06 +01:00
parent 5ad6e64ec1
commit ed533da6d4

View file

@ -111,11 +111,23 @@ class Config
} }
} }
} }
if (getenv('CONVERT')) { $this->getEnv();
$this->convert = (bool) getenv('CONVERT'); }
}
if (getenv('PYTHON')) { /**
$this->python = getenv('PYTHON'); * Override options from environement variables.
* Supported environment variables: CONVERT, PYTHON, AUDIO_BITRATE.
*
* @return void
*/
private function getEnv()
{
foreach (['CONVERT', 'PYTHON', 'AUDIO_BITRATE'] as $var) {
$env = getenv($var);
if ($env) {
$prop = lcfirst(str_replace('_', '', ucwords(strtolower($var), '_')));
$this->$prop = $env;
}
} }
} }