Огромный рефакторинг в пользу отказа от механизма environment и использования .env файла

Найдено и удалено немного мусора
This commit is contained in:
ErickSkrauch
2016-09-16 01:28:28 +03:00
parent e76a8324fb
commit 54485b2271
56 changed files with 209 additions and 763 deletions

View File

@@ -1,2 +1 @@
main-local.php
params-local.php

View File

@@ -0,0 +1,43 @@
<?php
use yii\helpers\ArrayHelper;
$rootPath = __DIR__ . '/../..';
$toMerge = [
require __DIR__ . '/main.php',
];
// Общие окружение-зависимые настройки
$path = __DIR__ . '/common-' . YII_ENV . '.php';
if (file_exists($path)) {
$toMerge[] = require $path;
}
// Общие локальные настройки
$path = __DIR__ . '/common-local.php';
if (file_exists($path)) {
$toMerge[] = require $path;
}
// Настройки конкретного приложения
$path = $rootPath . '/' . YII_APPLICATION_MODULE . '/config/main.php';
if (file_exists($path)) {
$toMerge[] = require $path;
}
// Настройки конкретного приложения для действующего окружения
$path = $rootPath . '/' . YII_APPLICATION_MODULE . '/config/main-' . YII_ENV . '.php';
if (file_exists($path)) {
$toMerge[] = require $path;
}
// Локальные настройки конкретного приложения
$path = $rootPath . '/' . YII_APPLICATION_MODULE . '/config/main-local.php';
if (file_exists($path)) {
$toMerge[] = require $path;
}
// не оставляем глобальных переменных, ну кроме $toMerge, хех
unset($path, $rootPath);
return ArrayHelper::merge(...$toMerge);

View File

@@ -0,0 +1,8 @@
<?php
return [
'components' => [
'mailer' => [
'useFileTransport' => true,
],
],
];

View File

@@ -8,6 +8,9 @@ return [
],
'db' => [
'class' => yii\db\Connection::class,
'dsn' => 'mysql:host=db;dbname=' . getenv('MYSQL_DATABASE'),
'username' => getenv('MYSQL_USER'),
'password' => getenv('MYSQL_PASSWORD'),
'charset' => 'utf8',
],
'mailer' => [
@@ -19,12 +22,21 @@ return [
],
'redis' => [
'class' => yii\redis\Connection::class,
'hostname' => 'redis',
'password' => null,
'port' => 6379,
'database' => 0,
],
'amqp' => [
'class' => \common\components\RabbitMQ\Component::class,
'class' => common\components\RabbitMQ\Component::class,
'host' => 'rabbitmq',
'port' => 5672,
'user' => getenv('RABBITMQ_DEFAULT_USER'),
'password' => getenv('RABBITMQ_DEFAULT_PASS'),
'vhost' => getenv('RABBITMQ_DEFAULT_VHOST'),
],
'guzzle' => [
'class' => \GuzzleHttp\Client::class,
'class' => GuzzleHttp\Client::class,
],
],
'aliases' => [

View File

@@ -1,6 +1,5 @@
<?php
return [
'adminEmail' => 'admin@example.com',
'supportEmail' => 'support@example.com',
'user.passwordResetTokenExpire' => 3600,
'fromEmail' => 'account@ely.by',
'supportEmail' => 'support@ely.by',
];