-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbootstrap.php
More file actions
29 lines (24 loc) · 919 Bytes
/
bootstrap.php
File metadata and controls
29 lines (24 loc) · 919 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
// Load custom config, if exists
ob_start();
$config = file_exists(__DIR__ . '/config.php') ?
require __DIR__ . '/config.php' :
[];
ob_end_clean();
if (empty($config['profile'])) {
$config['profile'] = 'production';
}
// Init Yii constants
$profiles = ['development' => 'dev', 'production' => 'prod', 'test' => 'test'];
defined('YII_DEBUG') || define('YII_DEBUG', false);
defined('YII_ENV') || define('YII_ENV', isset($profiles[$config['profile']]) ? $profiles[$config['profile']] : 'production');
// Init Yii autoloader
require(__DIR__ . '/vendor/autoload.php');
require(__DIR__ . '/app/core/base/Yii.php');
// Load environment config
$environmentConfigPath = __DIR__ . '/app/config/env/' . $config['profile'] . '.php';
if (file_exists($environmentConfigPath)) {
$config = \yii\helpers\ArrayHelper::merge(require $environmentConfigPath, $config);
}
unset($config['profile']);
return $config;