Fixed configs
This commit is contained in:
parent
1596e274a9
commit
0a70c89e75
3 changed files with 83 additions and 61 deletions
|
|
@ -1,43 +1,73 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPCI - Continuous Integration for PHP
|
||||
*
|
||||
* @copyright Copyright 2013, Block 8 Limited.
|
||||
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
||||
* @link http://www.phptesting.org/
|
||||
*/
|
||||
* PHPCI - Continuous Integration for PHP
|
||||
*
|
||||
* @copyright Copyright 2013, Block 8 Limited.
|
||||
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
||||
* @link http://www.phptesting.org/
|
||||
*/
|
||||
|
||||
// Let PHP take a guess as to the default timezone, if the user hasn't set one:
|
||||
date_default_timezone_set(@date_default_timezone_get());
|
||||
use PHPCI\Logging\LoggerConfig;
|
||||
|
||||
// Load Composer autoloader:
|
||||
require_once(dirname(__DIR__) . '/vendor/autoload.php');
|
||||
if (!defined('ROOT_DIR')) {
|
||||
define('ROOT_DIR', dirname(__DIR__) . DIRECTORY_SEPARATOR);
|
||||
}
|
||||
|
||||
// If the PHPCI config file is not where we expect it, try looking in
|
||||
// env for an alternative config path.
|
||||
$configFile = dirname(__DIR__) . '/app/PHPCI/config.yml';
|
||||
if (!defined('PHPCI_DIR')) {
|
||||
define('PHPCI_DIR', ROOT_DIR . 'src' . DIRECTORY_SEPARATOR . 'PHPCI' . DIRECTORY_SEPARATOR);
|
||||
}
|
||||
|
||||
if (!file_exists($configFile)) {
|
||||
$configEnv = getenv('phpci_config_file');
|
||||
if (!defined('PHPCI_PUBLIC_DIR')) {
|
||||
define('PHPCI_PUBLIC_DIR', ROOT_DIR . 'public' . DIRECTORY_SEPARATOR);
|
||||
}
|
||||
|
||||
if (!empty($configEnv)) {
|
||||
$configFile = $configEnv;
|
||||
}
|
||||
if (!defined('PHPCI_APP_DIR')) {
|
||||
define('PHPCI_APP_DIR', ROOT_DIR . 'app' . DIRECTORY_SEPARATOR);
|
||||
}
|
||||
|
||||
if (!defined('PHPCI_BIN_DIR')) {
|
||||
define('PHPCI_BIN_DIR', ROOT_DIR . 'bin' . DIRECTORY_SEPARATOR);
|
||||
}
|
||||
|
||||
if (!defined('PHPCI_RUNTIME_DIR')) {
|
||||
define('PHPCI_RUNTIME_DIR', ROOT_DIR . 'runtime' . DIRECTORY_SEPARATOR);
|
||||
}
|
||||
|
||||
if (!defined('PHPCI_BUILDS_DIR')) {
|
||||
define('PHPCI_BUILDS_DIR', ROOT_DIR . 'runtime' . DIRECTORY_SEPARATOR . 'builds' . DIRECTORY_SEPARATOR);
|
||||
}
|
||||
|
||||
if (!defined('IS_WIN')) {
|
||||
define('IS_WIN', ((strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') ? true : false));
|
||||
}
|
||||
|
||||
require_once(ROOT_DIR . 'vendor/autoload.php');
|
||||
|
||||
\PHPCI\ErrorHandler::register();
|
||||
|
||||
if (defined('PHPCI_IS_CONSOLE') && PHPCI_IS_CONSOLE) {
|
||||
$loggerConfig = LoggerConfig::newFromFile(PHPCI_APP_DIR . "loggerconfig.php");
|
||||
}
|
||||
|
||||
// Load configuration if present:
|
||||
$conf = [];
|
||||
$conf = [];
|
||||
$conf['b8']['app']['namespace'] = 'PHPCI';
|
||||
$conf['b8']['app']['default_controller'] = 'Home';
|
||||
$conf['b8']['view']['path'] = dirname(__DIR__) . '/src/PHPCI/View/';
|
||||
$conf['b8']['view']['path'] = PHPCI_DIR . 'View' . DIRECTORY_SEPARATOR;
|
||||
|
||||
$config = new b8\Config($conf);
|
||||
|
||||
$configFile = PHPCI_APP_DIR . 'config.yml';
|
||||
if (file_exists($configFile)) {
|
||||
$config->loadYaml($configFile);
|
||||
}
|
||||
|
||||
require_once(dirname(__DIR__) . '/vars.php');
|
||||
if (!defined('PHPCI_URL') && !empty($config)) {
|
||||
define('PHPCI_URL', $config->get('phpci.url', '') . '/');
|
||||
}
|
||||
|
||||
if (!defined('PHPCI_IS_CONSOLE')) {
|
||||
define('PHPCI_IS_CONSOLE', false);
|
||||
}
|
||||
|
||||
\PHPCI\Helper\Lang::init($config);
|
||||
\PHPCI\Helper\Lang::setLanguage("en");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue