New environment variable: AUDIO_BITRATE
Refactor environment variables code
This commit is contained in:
parent
5ad6e64ec1
commit
ed533da6d4
1 changed files with 17 additions and 5 deletions
|
@ -111,11 +111,23 @@ class Config
|
|||
}
|
||||
}
|
||||
}
|
||||
if (getenv('CONVERT')) {
|
||||
$this->convert = (bool) getenv('CONVERT');
|
||||
}
|
||||
if (getenv('PYTHON')) {
|
||||
$this->python = getenv('PYTHON');
|
||||
$this->getEnv();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue