Merge branch 'conf-path-handling'
This commit is contained in:
commit
82f1431440
2 changed files with 16 additions and 9 deletions
|
@ -161,7 +161,7 @@ class = Filesystem
|
||||||
[model_options]
|
[model_options]
|
||||||
dir = PATH "data"
|
dir = PATH "data"
|
||||||
|
|
||||||
[model]
|
;[model]
|
||||||
; example of a Google Cloud Storage configuration
|
; example of a Google Cloud Storage configuration
|
||||||
;class = GoogleCloudStorage
|
;class = GoogleCloudStorage
|
||||||
;[model_options]
|
;[model_options]
|
||||||
|
|
|
@ -101,10 +101,15 @@ class Configuration
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
$basePaths = array();
|
||||||
$config = array();
|
$config = array();
|
||||||
$basePath = (getenv('CONFIG_PATH') !== false ? getenv('CONFIG_PATH') : PATH . 'cfg') . DIRECTORY_SEPARATOR;
|
$configPath = getenv('CONFIG_PATH');
|
||||||
$configFile = $basePath . 'conf.php';
|
if ($configPath !== false && !empty($configPath)) {
|
||||||
|
$basePaths[] = $configPath;
|
||||||
|
}
|
||||||
|
$basePaths[] = PATH . 'cfg';
|
||||||
|
foreach ($basePaths as $basePath) {
|
||||||
|
$configFile = $basePath . DIRECTORY_SEPARATOR . 'conf.php';
|
||||||
if (is_readable($configFile)) {
|
if (is_readable($configFile)) {
|
||||||
$config = parse_ini_file($configFile, true);
|
$config = parse_ini_file($configFile, true);
|
||||||
foreach (array('main', 'model', 'model_options') as $section) {
|
foreach (array('main', 'model', 'model_options') as $section) {
|
||||||
|
@ -112,6 +117,8 @@ class Configuration
|
||||||
throw new Exception(I18n::_('PrivateBin requires configuration section [%s] to be present in configuration file.', $section), 2);
|
throw new Exception(I18n::_('PrivateBin requires configuration section [%s] to be present in configuration file.', $section), 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$opts = '_options';
|
$opts = '_options';
|
||||||
|
|
Loading…
Reference in a new issue