mirror of
https://github.com/elyby/accounts.git
synced 2024-11-30 02:32:26 +05:30
Огромный рефакторинг в пользу отказа от механизма environment и использования .env файла
Найдено и удалено немного мусора
This commit is contained in:
parent
e76a8324fb
commit
54485b2271
@ -5,9 +5,8 @@
|
||||
vendor
|
||||
# node_modules для этого контейнера не нужны
|
||||
frontend/node_modules
|
||||
|
||||
# Все -local файлы
|
||||
*/config/*-local.php
|
||||
frontend/webpack/node_modules
|
||||
frontend/scripts/node_modules
|
||||
|
||||
# Все временные файлы
|
||||
*/runtime
|
||||
|
26
.env
26
.env
@ -1,2 +1,26 @@
|
||||
XDEBUG_CONFIG=remote_host=192.168.99.1
|
||||
# Основные параметры
|
||||
YII_DEBUG=true
|
||||
YII_ENV=dev
|
||||
JWT_USER_SECRET=edee109cad8b323d6d9edbcf406d945a989af6b6d251e4953a48df756695963a
|
||||
|
||||
# Web
|
||||
VIRTUAL_HOST=account.ely.by.local,authserver.ely.by.local
|
||||
AUTHSERVER_HOST=authserver.ely.by.local
|
||||
# LETSENCRYPT_HOST=account.ely.by
|
||||
# LETSENCRYPT_EMAIL=erickskrauch@ely.by
|
||||
|
||||
# MySQL
|
||||
MYSQL_ALLOW_EMPTY_PASSWORD=yes
|
||||
MYSQL_ROOT_PASSWORD=
|
||||
MYSQL_DATABASE=ely_accounts
|
||||
MYSQL_USER=ely_accounts_user
|
||||
MYSQL_PASSWORD=ely_accounts_password
|
||||
|
||||
# RabbitMQ
|
||||
RABBITMQ_DEFAULT_USER=ely-accounts-app
|
||||
RABBITMQ_DEFAULT_PASS=ely-accounts-app-password
|
||||
RABBITMQ_DEFAULT_VHOST=/ely.by
|
||||
|
||||
# Конфигурация для Dev.
|
||||
XDEBUG_CONFIG=remote_host=10.254.254.254
|
||||
PHP_IDE_CONFIG=serverName=docker
|
||||
|
26
.env-dist
Normal file
26
.env-dist
Normal file
@ -0,0 +1,26 @@
|
||||
# Основные параметры
|
||||
YII_DEBUG=true
|
||||
YII_ENV=dev
|
||||
JWT_USER_SECRET=
|
||||
|
||||
# Web
|
||||
VIRTUAL_HOST=account.ely.by,authserver.ely.by
|
||||
AUTHSERVER_HOST=authserver.ely.by
|
||||
# LETSENCRYPT_HOST=account.ely.by
|
||||
# LETSENCRYPT_EMAIL=erickskrauch@ely.by
|
||||
|
||||
# MySQL
|
||||
MYSQL_ALLOW_EMPTY_PASSWORD=yes
|
||||
MYSQL_ROOT_PASSWORD=
|
||||
MYSQL_DATABASE=ely_accounts
|
||||
MYSQL_USER=ely_accounts_user
|
||||
MYSQL_PASSWORD=ely_accounts_password
|
||||
|
||||
# RabbitMQ
|
||||
RABBITMQ_DEFAULT_USER=ely-accounts-app
|
||||
RABBITMQ_DEFAULT_PASS=ely-accounts-app-password
|
||||
RABBITMQ_DEFAULT_VHOST=/ely.by
|
||||
|
||||
# Конфигурация для Dev.
|
||||
XDEBUG_CONFIG=remote_host=10.254.254.254
|
||||
PHP_IDE_CONFIG=serverName=docker
|
10
.gitignore
vendored
10
.gitignore
vendored
@ -1,6 +1,3 @@
|
||||
# yii console command
|
||||
/yii
|
||||
|
||||
# phpstorm project files
|
||||
.idea
|
||||
|
||||
@ -19,8 +16,8 @@ Thumbs.db
|
||||
/vendor
|
||||
|
||||
# composer itself is not needed
|
||||
composer.phar
|
||||
composer.lock
|
||||
/composer.phar
|
||||
/composer.lock
|
||||
|
||||
# Mac DS_Store Files
|
||||
.DS_Store
|
||||
@ -35,3 +32,6 @@ npm-debug*
|
||||
|
||||
# Docker override file
|
||||
docker-compose.override.yml
|
||||
|
||||
# Локальный .env
|
||||
/.env
|
||||
|
1
api/config/.gitignore
vendored
1
api/config/.gitignore
vendored
@ -1,2 +1 @@
|
||||
main-local.php
|
||||
params-local.php
|
19
api/config/main-dev.php
Normal file
19
api/config/main-dev.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
return [
|
||||
'bootstrap' => ['debug', 'gii'],
|
||||
'components' => [
|
||||
'reCaptcha' => [
|
||||
'public' => '6LfwqCYTAAAAAJlaJpqCdzESCjAXUC81Ca6jBHR7',
|
||||
'secret' => '6LfwqCYTAAAAAFPjHmgwmnjSMFeAOJh7Lk5xxDMC',
|
||||
],
|
||||
],
|
||||
'modules' => [
|
||||
'debug' => [
|
||||
'class' => yii\debug\Module::class,
|
||||
'allowedIPs' => ['*'],
|
||||
],
|
||||
'gii' => [
|
||||
'class' => yii\gii\Module::class,
|
||||
],
|
||||
],
|
||||
];
|
@ -1,9 +1,7 @@
|
||||
<?php
|
||||
$params = array_merge(
|
||||
require(__DIR__ . '/../../common/config/params.php'),
|
||||
require(__DIR__ . '/../../common/config/params-local.php'),
|
||||
require(__DIR__ . '/params.php'),
|
||||
require(__DIR__ . '/params-local.php')
|
||||
require(__DIR__ . '/params.php')
|
||||
);
|
||||
|
||||
return [
|
||||
@ -14,17 +12,17 @@ return [
|
||||
'params' => $params,
|
||||
'components' => [
|
||||
'user' => [
|
||||
'class' => \api\components\User\Component::class,
|
||||
'secret' => $params['userSecret'],
|
||||
'class' => api\components\User\Component::class,
|
||||
'secret' => getenv('JWT_USER_SECRET'),
|
||||
],
|
||||
'apiUser' => [
|
||||
'class' => \api\components\ApiUser\Component::class,
|
||||
'class' => api\components\ApiUser\Component::class,
|
||||
],
|
||||
'log' => [
|
||||
'traceLevel' => YII_DEBUG ? 3 : 0,
|
||||
'targets' => [
|
||||
[
|
||||
'class' => \yii\log\FileTarget::class,
|
||||
'class' => yii\log\FileTarget::class,
|
||||
'levels' => ['error', 'warning'],
|
||||
'except' => [
|
||||
'legacy-authserver',
|
||||
@ -34,13 +32,13 @@ return [
|
||||
],
|
||||
],
|
||||
[
|
||||
'class' => \yii\log\FileTarget::class,
|
||||
'class' => yii\log\FileTarget::class,
|
||||
'levels' => ['error', 'info'],
|
||||
'categories' => ['legacy-authserver'],
|
||||
'logFile' => '@runtime/logs/authserver.log',
|
||||
],
|
||||
[
|
||||
'class' => \yii\log\FileTarget::class,
|
||||
'class' => yii\log\FileTarget::class,
|
||||
'levels' => ['error', 'info'],
|
||||
'categories' => ['session'],
|
||||
'logFile' => '@runtime/logs/session.log',
|
||||
@ -56,26 +54,26 @@ return [
|
||||
'rules' => require __DIR__ . '/routes.php',
|
||||
],
|
||||
'reCaptcha' => [
|
||||
'class' => \api\components\ReCaptcha\Component::class,
|
||||
'class' => api\components\ReCaptcha\Component::class,
|
||||
],
|
||||
'response' => [
|
||||
'format' => \yii\web\Response::FORMAT_JSON,
|
||||
'format' => yii\web\Response::FORMAT_JSON,
|
||||
],
|
||||
'oauth' => [
|
||||
'class' => \common\components\oauth\Component::class,
|
||||
'class' => common\components\oauth\Component::class,
|
||||
'grantTypes' => ['authorization_code'],
|
||||
],
|
||||
'errorHandler' => [
|
||||
'class' => \api\components\ErrorHandler::class,
|
||||
'class' => api\components\ErrorHandler::class,
|
||||
],
|
||||
],
|
||||
'modules' => [
|
||||
'authserver' => [
|
||||
'class' => \api\modules\authserver\Module::class,
|
||||
'baseDomain' => $params['authserverDomain'],
|
||||
'class' => api\modules\authserver\Module::class,
|
||||
'baseDomain' => getenv('AUTHSERVER_HOST'),
|
||||
],
|
||||
'session' => [
|
||||
'class' => \api\modules\session\Module::class,
|
||||
'class' => api\modules\session\Module::class,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
@ -1,4 +1,3 @@
|
||||
<?php
|
||||
return [
|
||||
'adminEmail' => 'admin@example.com',
|
||||
];
|
||||
|
@ -25,6 +25,7 @@ class SessionController extends ApiController {
|
||||
$behaviors['rateLimiting'] = [
|
||||
'class' => RateLimiter::class,
|
||||
'only' => ['has-joined', 'has-joined-legacy'],
|
||||
'authserverDomain' => getenv('AUTHSERVER_HOST'),
|
||||
];
|
||||
|
||||
return $behaviors;
|
||||
|
@ -18,10 +18,6 @@ class RateLimiter extends \yii\filters\RateLimiter {
|
||||
|
||||
public function init() {
|
||||
parent::init();
|
||||
if ($this->authserverDomain === null) {
|
||||
$this->authserverDomain = Yii::$app->params['authserverDomain'] ?? null;
|
||||
}
|
||||
|
||||
if ($this->authserverDomain === null) {
|
||||
throw new InvalidConfigException('authserverDomain param is required');
|
||||
}
|
||||
@ -45,6 +41,7 @@ class RateLimiter extends \yii\filters\RateLimiter {
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function checkRateLimit($user, $request, $response, $action) {
|
||||
// TODO: теперь в authserverDomain хранится hostname без schema, а getHostInfo() возвращает с http(s).
|
||||
if ($request->getHostInfo() === $this->authserverDomain) {
|
||||
return;
|
||||
}
|
||||
|
2
api/web/.gitignore
vendored
2
api/web/.gitignore
vendored
@ -1,2 +0,0 @@
|
||||
/index.php
|
||||
/index-test.php
|
Binary file not shown.
Before Width: | Height: | Size: 318 B |
16
api/web/index.php
Normal file
16
api/web/index.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
require __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
defined('YII_DEBUG') or define('YII_DEBUG', (boolean)getenv('YII_DEBUG'));
|
||||
defined('YII_ENV') or define('YII_ENV', getenv('YII_ENV'));
|
||||
defined('YII_APPLICATION_TYPE') or define('YII_APPLICATION_TYPE', 'web');
|
||||
defined('YII_APPLICATION_MODULE') or define('YII_APPLICATION_MODULE', 'api');
|
||||
|
||||
require __DIR__ . '/../../vendor/yiisoft/yii2/Yii.php';
|
||||
require __DIR__ . '/../../common/config/bootstrap.php';
|
||||
require __DIR__ . '/../config/bootstrap.php';
|
||||
|
||||
$config = require __DIR__ . './../../common/config/config-loader.php';
|
||||
|
||||
$application = new yii\web\Application($config);
|
||||
$application->run();
|
1
common/config/.gitignore
vendored
1
common/config/.gitignore
vendored
@ -1,2 +1 @@
|
||||
main-local.php
|
||||
params-local.php
|
||||
|
43
common/config/config-loader.php
Normal file
43
common/config/config-loader.php
Normal 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);
|
8
common/config/main-dev.php
Normal file
8
common/config/main-dev.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
return [
|
||||
'components' => [
|
||||
'mailer' => [
|
||||
'useFileTransport' => true,
|
||||
],
|
||||
],
|
||||
];
|
@ -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' => [
|
||||
|
@ -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',
|
||||
];
|
||||
|
1
console/config/.gitignore
vendored
1
console/config/.gitignore
vendored
@ -1,2 +1 @@
|
||||
main-local.php
|
||||
params-local.php
|
@ -1,21 +1,20 @@
|
||||
<?php
|
||||
$params = array_merge(
|
||||
require(__DIR__ . '/../../common/config/params.php'),
|
||||
require(__DIR__ . '/../../common/config/params-local.php'),
|
||||
require(__DIR__ . '/params.php'),
|
||||
require(__DIR__ . '/params-local.php')
|
||||
require(__DIR__ . '/params.php')
|
||||
);
|
||||
|
||||
return [
|
||||
'id' => 'app-console',
|
||||
'id' => 'accounts-console',
|
||||
'basePath' => dirname(__DIR__),
|
||||
'bootstrap' => ['log'],
|
||||
'controllerNamespace' => 'console\controllers',
|
||||
'params' => $params,
|
||||
'components' => [
|
||||
'log' => [
|
||||
'targets' => [
|
||||
[
|
||||
'class' => 'yii\log\FileTarget',
|
||||
'class' => yii\log\FileTarget::class,
|
||||
'levels' => ['error', 'warning'],
|
||||
],
|
||||
],
|
||||
@ -23,9 +22,8 @@ return [
|
||||
],
|
||||
'controllerMap' => [
|
||||
'migrate' => [
|
||||
'class' => 'yii\console\controllers\MigrateController',
|
||||
'class' => yii\console\controllers\MigrateController::class,
|
||||
'templateFile' => '@console/views/migration.php',
|
||||
],
|
||||
],
|
||||
'params' => $params,
|
||||
];
|
||||
|
@ -1,4 +1,3 @@
|
||||
<?php
|
||||
return [
|
||||
'adminEmail' => 'admin@example.com',
|
||||
];
|
||||
|
@ -2,29 +2,21 @@ version: '2'
|
||||
services:
|
||||
app:
|
||||
build: .
|
||||
links:
|
||||
depends_on:
|
||||
- db
|
||||
- redis
|
||||
- rabbitmq
|
||||
depends_on:
|
||||
- app-console-account-queue
|
||||
volumes:
|
||||
- ./:/var/www/html/
|
||||
env_file: .env
|
||||
networks:
|
||||
- default
|
||||
- nginx-proxy
|
||||
|
||||
web:
|
||||
build: ./docker/nginx
|
||||
links:
|
||||
- app
|
||||
volumes_from:
|
||||
- app
|
||||
environment:
|
||||
- AUTHSERVER_HOST=authserver.ely.by.local
|
||||
- PHP_LINK=app
|
||||
- VIRTUAL_HOST=account.ely.by.local,authserver.ely.by.local
|
||||
links:
|
||||
- app:php
|
||||
env_file: .env
|
||||
networks:
|
||||
- default
|
||||
- nginx-proxy
|
||||
@ -42,7 +34,7 @@ services:
|
||||
build: .
|
||||
volumes:
|
||||
- ./:/var/www/html/
|
||||
command: ["./docker/wait-for-it.sh", "rabbitmq:5672", "--", "./yii account-queue"]
|
||||
command: ["docker/wait-for-it.sh", "rabbitmq:5672", "--", "php", "yii", "account-queue"]
|
||||
links:
|
||||
- db
|
||||
- redis
|
||||
@ -50,22 +42,14 @@ services:
|
||||
|
||||
db:
|
||||
build: ./docker/mariadb
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: ""
|
||||
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
|
||||
MYSQL_DATABASE: "ely_accounts"
|
||||
MYSQL_USER: "ely_accounts_user"
|
||||
MYSQL_PASSWORD: "ely_accounts_password"
|
||||
env_file: .env
|
||||
|
||||
redis:
|
||||
image: redis:3.0
|
||||
|
||||
rabbitmq:
|
||||
build: ./docker/rabbitmq
|
||||
environment:
|
||||
RABBITMQ_DEFAULT_USER: "ely-accounts-app"
|
||||
RABBITMQ_DEFAULT_PASS: "ely-accounts-app-password"
|
||||
RABBITMQ_DEFAULT_VHOST: "/ely.by"
|
||||
env_file: .env
|
||||
ports:
|
||||
- "15672:15672" # Manager interface
|
||||
|
||||
@ -77,7 +61,7 @@ services:
|
||||
- PMA_PASSWORD=
|
||||
ports:
|
||||
- "8181:80"
|
||||
links:
|
||||
depends_on:
|
||||
- db
|
||||
|
||||
networks:
|
||||
|
@ -34,7 +34,7 @@ server {
|
||||
}
|
||||
|
||||
location ~* \.php$ {
|
||||
fastcgi_pass ${PHP_LINK}:9000;
|
||||
fastcgi_pass php:9000;
|
||||
include fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_param SERVER_NAME $host;
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
envsubst '$AUTHSERVER_HOST:$PHP_LINK' < /etc/nginx/conf.d/account.ely.by.conf.template > /etc/nginx/conf.d/default.conf
|
||||
envsubst '$AUTHSERVER_HOST' < /etc/nginx/conf.d/account.ely.by.conf.template > /etc/nginx/conf.d/default.conf
|
||||
|
||||
exec "$@"
|
||||
|
@ -1,26 +0,0 @@
|
||||
<?php
|
||||
|
||||
$config = [
|
||||
'components' => [
|
||||
'request' => [
|
||||
// !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
|
||||
'cookieValidationKey' => '',
|
||||
'enableCsrfValidation' => false,
|
||||
],
|
||||
'reCaptcha' => [
|
||||
'public' => '',
|
||||
'secret' => '',
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
if (!YII_ENV_TEST) {
|
||||
// configuration adjustments for 'dev' environment
|
||||
$config['bootstrap'][] = 'debug';
|
||||
$config['modules']['debug'] = 'yii\debug\Module';
|
||||
|
||||
$config['bootstrap'][] = 'gii';
|
||||
$config['modules']['gii'] = 'yii\gii\Module';
|
||||
}
|
||||
|
||||
return $config;
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
return [
|
||||
'userSecret' => 'some-long-secret-key',
|
||||
'authserverDomain' => 'http://authserver.ely.by.local',
|
||||
];
|
@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
// NOTE: Make sure this file is not accessible when deployed to production
|
||||
if (!in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', '::1'])) {
|
||||
die('You are not allowed to access this file.');
|
||||
}
|
||||
|
||||
defined('YII_DEBUG') or define('YII_DEBUG', true);
|
||||
defined('YII_ENV') or define('YII_ENV', 'test');
|
||||
|
||||
require(__DIR__ . '/../../vendor/autoload.php');
|
||||
require(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php');
|
||||
require(__DIR__ . '/../../common/config/bootstrap.php');
|
||||
require(__DIR__ . '/../config/bootstrap.php');
|
||||
|
||||
$config = require(__DIR__ . '/../../tests/codeception/config/api/acceptance.php');
|
||||
|
||||
(new yii\web\Application($config))->run();
|
@ -1,18 +0,0 @@
|
||||
<?php
|
||||
defined('YII_DEBUG') or define('YII_DEBUG', true);
|
||||
defined('YII_ENV') or define('YII_ENV', 'dev');
|
||||
|
||||
require(__DIR__ . '/../../vendor/autoload.php');
|
||||
require(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php');
|
||||
require(__DIR__ . '/../../common/config/bootstrap.php');
|
||||
require(__DIR__ . '/../config/bootstrap.php');
|
||||
|
||||
$config = yii\helpers\ArrayHelper::merge(
|
||||
require(__DIR__ . '/../../common/config/main.php'),
|
||||
require(__DIR__ . '/../../common/config/main-local.php'),
|
||||
require(__DIR__ . '/../config/main.php'),
|
||||
require(__DIR__ . '/../config/main-local.php')
|
||||
);
|
||||
|
||||
$application = new yii\web\Application($config);
|
||||
$application->run();
|
@ -1,29 +0,0 @@
|
||||
<?php
|
||||
return [
|
||||
'components' => [
|
||||
'db' => [
|
||||
'dsn' => 'mysql:host=localhost;dbname=ely_accounts',
|
||||
'username' => 'root',
|
||||
'password' => '',
|
||||
],
|
||||
'mailer' => [
|
||||
// send all mails to a file by default. You have to set
|
||||
// 'useFileTransport' to false and configure a transport
|
||||
// for the mailer to send real emails.
|
||||
'useFileTransport' => true,
|
||||
],
|
||||
'redis' => [
|
||||
'hostname' => 'localhost',
|
||||
'password' => null,
|
||||
'port' => 6379,
|
||||
'database' => 0,
|
||||
],
|
||||
'amqp' => [
|
||||
'host' => 'localhost',
|
||||
'port' => 5672,
|
||||
'user' => 'ely-accounts-app',
|
||||
'password' => 'app-password',
|
||||
'vhost' => '/account.ely.by',
|
||||
],
|
||||
],
|
||||
];
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
return [
|
||||
'fromEmail' => 'account@ely.by',
|
||||
'supportEmail' => 'support@ely.by',
|
||||
];
|
@ -1,3 +0,0 @@
|
||||
<?php
|
||||
return [
|
||||
];
|
@ -1,28 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
/**
|
||||
* Yii console bootstrap file.
|
||||
*
|
||||
* @link http://www.yiiframework.com/
|
||||
* @copyright Copyright (c) 2008 Yii Software LLC
|
||||
* @license http://www.yiiframework.com/license/
|
||||
*/
|
||||
|
||||
defined('YII_DEBUG') or define('YII_DEBUG', true);
|
||||
defined('YII_ENV') or define('YII_ENV', 'dev');
|
||||
|
||||
require(__DIR__ . '/vendor/autoload.php');
|
||||
require(__DIR__ . '/vendor/yiisoft/yii2/Yii.php');
|
||||
require(__DIR__ . '/common/config/bootstrap.php');
|
||||
require(__DIR__ . '/console/config/bootstrap.php');
|
||||
|
||||
$config = yii\helpers\ArrayHelper::merge(
|
||||
require(__DIR__ . '/common/config/main.php'),
|
||||
require(__DIR__ . '/common/config/main-local.php'),
|
||||
require(__DIR__ . '/console/config/main.php'),
|
||||
require(__DIR__ . '/console/config/main-local.php')
|
||||
);
|
||||
|
||||
$application = new yii\console\Application($config);
|
||||
$exitCode = $application->run();
|
||||
exit($exitCode);
|
@ -1,2 +0,0 @@
|
||||
XDEBUG_CONFIG=remote_host=192.168.99.1
|
||||
PHP_IDE_CONFIG=serverName=docker
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
$config = [
|
||||
'components' => [
|
||||
'request' => [
|
||||
// !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
|
||||
'cookieValidationKey' => '',
|
||||
],
|
||||
'reCaptcha' => [
|
||||
'public' => '',
|
||||
'secret' => '',
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
if (!YII_ENV_TEST) {
|
||||
// configuration adjustments for 'dev' environment
|
||||
$config['bootstrap'][] = 'debug';
|
||||
$config['modules']['debug'] = \yii\debug\Module::class;
|
||||
|
||||
$config['bootstrap'][] = 'gii';
|
||||
$config['modules']['gii'] = \yii\gii\Module::class;
|
||||
}
|
||||
|
||||
return $config;
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
return [
|
||||
'userSecret' => 'some-long-secret-key',
|
||||
'authserverDomain' => 'https://authserver.ely.by',
|
||||
];
|
@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
// NOTE: Make sure this file is not accessible when deployed to production
|
||||
if (!in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', '::1'])) {
|
||||
die('You are not allowed to access this file.');
|
||||
}
|
||||
|
||||
defined('YII_DEBUG') or define('YII_DEBUG', true);
|
||||
defined('YII_ENV') or define('YII_ENV', 'test');
|
||||
|
||||
require(__DIR__ . '/../../vendor/autoload.php');
|
||||
require(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php');
|
||||
require(__DIR__ . '/../../common/config/bootstrap.php');
|
||||
require(__DIR__ . '/../config/bootstrap.php');
|
||||
|
||||
$config = require(__DIR__ . '/../../tests/codeception/config/api/acceptance.php');
|
||||
|
||||
(new yii\web\Application($config))->run();
|
@ -1,18 +0,0 @@
|
||||
<?php
|
||||
defined('YII_DEBUG') or define('YII_DEBUG', true);
|
||||
defined('YII_ENV') or define('YII_ENV', 'dev');
|
||||
|
||||
require(__DIR__ . '/../../vendor/autoload.php');
|
||||
require(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php');
|
||||
require(__DIR__ . '/../../common/config/bootstrap.php');
|
||||
require(__DIR__ . '/../config/bootstrap.php');
|
||||
|
||||
$config = yii\helpers\ArrayHelper::merge(
|
||||
require(__DIR__ . '/../../common/config/main.php'),
|
||||
require(__DIR__ . '/../../common/config/main-local.php'),
|
||||
require(__DIR__ . '/../config/main.php'),
|
||||
require(__DIR__ . '/../config/main-local.php')
|
||||
);
|
||||
|
||||
$application = new yii\web\Application($config);
|
||||
$application->run();
|
@ -1,26 +0,0 @@
|
||||
<?php
|
||||
return [
|
||||
'components' => [
|
||||
'db' => [
|
||||
'dsn' => 'mysql:host=db;dbname=ely_accounts',
|
||||
'username' => 'ely_accounts_user',
|
||||
'password' => 'ely_accounts_password',
|
||||
],
|
||||
'mailer' => [
|
||||
'useFileTransport' => true,
|
||||
],
|
||||
'redis' => [
|
||||
'hostname' => 'redis',
|
||||
'password' => null,
|
||||
'port' => 6379,
|
||||
'database' => 0,
|
||||
],
|
||||
'amqp' => [
|
||||
'host' => 'rabbitmq',
|
||||
'port' => 5672,
|
||||
'user' => 'ely-accounts-app',
|
||||
'password' => 'ely-accounts-app-password',
|
||||
'vhost' => '/ely.by',
|
||||
],
|
||||
],
|
||||
];
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
return [
|
||||
'fromEmail' => 'account@ely.by',
|
||||
'supportEmail' => 'support@ely.by',
|
||||
];
|
@ -1,7 +0,0 @@
|
||||
<?php
|
||||
return [
|
||||
'bootstrap' => ['gii'],
|
||||
'modules' => [
|
||||
'gii' => \yii\gii\Module::class,
|
||||
],
|
||||
];
|
@ -1,3 +0,0 @@
|
||||
<?php
|
||||
return [
|
||||
];
|
@ -1,28 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
/**
|
||||
* Yii console bootstrap file.
|
||||
*
|
||||
* @link http://www.yiiframework.com/
|
||||
* @copyright Copyright (c) 2008 Yii Software LLC
|
||||
* @license http://www.yiiframework.com/license/
|
||||
*/
|
||||
|
||||
defined('YII_DEBUG') or define('YII_DEBUG', true);
|
||||
defined('YII_ENV') or define('YII_ENV', 'dev');
|
||||
|
||||
require(__DIR__ . '/vendor/autoload.php');
|
||||
require(__DIR__ . '/vendor/yiisoft/yii2/Yii.php');
|
||||
require(__DIR__ . '/common/config/bootstrap.php');
|
||||
require(__DIR__ . '/console/config/bootstrap.php');
|
||||
|
||||
$config = yii\helpers\ArrayHelper::merge(
|
||||
require(__DIR__ . '/common/config/main.php'),
|
||||
require(__DIR__ . '/common/config/main-local.php'),
|
||||
require(__DIR__ . '/console/config/main.php'),
|
||||
require(__DIR__ . '/console/config/main-local.php')
|
||||
);
|
||||
|
||||
$application = new yii\console\Application($config);
|
||||
$exitCode = $application->run();
|
||||
exit($exitCode);
|
@ -1,73 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* The manifest of files that are local to specific environment.
|
||||
* This file returns a list of environments that the application
|
||||
* may be installed under. The returned data must be in the following
|
||||
* format:
|
||||
*
|
||||
* ```php
|
||||
* return [
|
||||
* 'environment name' => [
|
||||
* 'path' => 'directory storing the local files',
|
||||
* 'skipFiles' => [
|
||||
* // list of files that should only copied once and skipped if they already exist
|
||||
* ],
|
||||
* 'setWritable' => [
|
||||
* // list of directories that should be set writable
|
||||
* ],
|
||||
* 'setExecutable' => [
|
||||
* // list of files that should be set executable
|
||||
* ],
|
||||
* 'setCookieValidationKey' => [
|
||||
* // list of config files that need to be inserted with automatically generated cookie validation keys
|
||||
* ],
|
||||
* 'createSymlink' => [
|
||||
* // list of symlinks to be created. Keys are symlinks, and values are the targets.
|
||||
* ],
|
||||
* ],
|
||||
* ];
|
||||
* ```
|
||||
*/
|
||||
return [
|
||||
'Development' => [
|
||||
'path' => 'dev',
|
||||
'setWritable' => [
|
||||
'api/runtime',
|
||||
'api/web/assets',
|
||||
],
|
||||
'setExecutable' => [
|
||||
'yii',
|
||||
'tests/codeception/bin/yii',
|
||||
],
|
||||
'setCookieValidationKey' => [
|
||||
'api/config/main-local.php',
|
||||
],
|
||||
],
|
||||
'Docker' => [
|
||||
'path' => 'docker',
|
||||
'setWritable' => [
|
||||
'api/runtime',
|
||||
'api/web/assets',
|
||||
],
|
||||
'setExecutable' => [
|
||||
'yii',
|
||||
'tests/codeception/bin/yii',
|
||||
],
|
||||
'setCookieValidationKey' => [
|
||||
'api/config/main-local.php',
|
||||
],
|
||||
],
|
||||
'Production' => [
|
||||
'path' => 'prod',
|
||||
'setWritable' => [
|
||||
'api/runtime',
|
||||
'api/web/assets',
|
||||
],
|
||||
'setExecutable' => [
|
||||
'yii',
|
||||
],
|
||||
'setCookieValidationKey' => [
|
||||
'api/config/main-local.php',
|
||||
],
|
||||
],
|
||||
];
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
return [
|
||||
'components' => [
|
||||
'request' => [
|
||||
// !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
|
||||
'cookieValidationKey' => '',
|
||||
],
|
||||
'reCaptcha' => [
|
||||
'public' => '',
|
||||
'secret' => '',
|
||||
],
|
||||
],
|
||||
];
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
return [
|
||||
'userSecret' => 'some-long-secret-key',
|
||||
'authserverDomain' => 'https://authserver.ely.by',
|
||||
];
|
@ -1,18 +0,0 @@
|
||||
<?php
|
||||
defined('YII_DEBUG') or define('YII_DEBUG', false);
|
||||
defined('YII_ENV') or define('YII_ENV', 'prod');
|
||||
|
||||
require(__DIR__ . '/../../vendor/autoload.php');
|
||||
require(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php');
|
||||
require(__DIR__ . '/../../common/config/bootstrap.php');
|
||||
require(__DIR__ . '/../config/bootstrap.php');
|
||||
|
||||
$config = yii\helpers\ArrayHelper::merge(
|
||||
require(__DIR__ . '/../../common/config/main.php'),
|
||||
require(__DIR__ . '/../../common/config/main-local.php'),
|
||||
require(__DIR__ . '/../config/main.php'),
|
||||
require(__DIR__ . '/../config/main-local.php')
|
||||
);
|
||||
|
||||
$application = new yii\web\Application($config);
|
||||
$application->run();
|
@ -1,23 +0,0 @@
|
||||
<?php
|
||||
return [
|
||||
'components' => [
|
||||
'db' => [
|
||||
'dsn' => 'mysql:host=localhost;dbname=ely_accounts',
|
||||
'username' => 'root',
|
||||
'password' => '',
|
||||
],
|
||||
'redis' => [
|
||||
'hostname' => 'localhost',
|
||||
'password' => null,
|
||||
'port' => 6379,
|
||||
'database' => 0,
|
||||
],
|
||||
'amqp' => [
|
||||
'host' => 'localhost',
|
||||
'port' => 5672,
|
||||
'user' => 'ely-accounts-app',
|
||||
'password' => 'app-password',
|
||||
'vhost' => '/account.ely.by',
|
||||
],
|
||||
],
|
||||
];
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
return [
|
||||
'fromEmail' => 'account@ely.by',
|
||||
'supportEmail' => 'support@ely.by',
|
||||
];
|
@ -1,3 +0,0 @@
|
||||
<?php
|
||||
return [
|
||||
];
|
@ -1,3 +0,0 @@
|
||||
<?php
|
||||
return [
|
||||
];
|
@ -1,28 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
/**
|
||||
* Yii console bootstrap file.
|
||||
*
|
||||
* @link http://www.yiiframework.com/
|
||||
* @copyright Copyright (c) 2008 Yii Software LLC
|
||||
* @license http://www.yiiframework.com/license/
|
||||
*/
|
||||
|
||||
defined('YII_DEBUG') or define('YII_DEBUG', false);
|
||||
defined('YII_ENV') or define('YII_ENV', 'prod');
|
||||
|
||||
require(__DIR__ . '/vendor/autoload.php');
|
||||
require(__DIR__ . '/vendor/yiisoft/yii2/Yii.php');
|
||||
require(__DIR__ . '/common/config/bootstrap.php');
|
||||
require(__DIR__ . '/console/config/bootstrap.php');
|
||||
|
||||
$config = yii\helpers\ArrayHelper::merge(
|
||||
require(__DIR__ . '/common/config/main.php'),
|
||||
require(__DIR__ . '/common/config/main-local.php'),
|
||||
require(__DIR__ . '/console/config/main.php'),
|
||||
require(__DIR__ . '/console/config/main-local.php')
|
||||
);
|
||||
|
||||
$application = new yii\console\Application($config);
|
||||
$exitCode = $application->run();
|
||||
exit($exitCode);
|
209
init
209
init
@ -1,209 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
/**
|
||||
* Yii Application Initialization Tool
|
||||
*
|
||||
* In order to run in non-interactive mode:
|
||||
*
|
||||
* init --env=Development --overwrite=n
|
||||
*
|
||||
* @author Alexander Makarov <sam@rmcreative.ru>
|
||||
*
|
||||
* @link http://www.yiiframework.com/
|
||||
* @copyright Copyright (c) 2008 Yii Software LLC
|
||||
* @license http://www.yiiframework.com/license/
|
||||
*/
|
||||
|
||||
if (!extension_loaded('openssl')) {
|
||||
die('The OpenSSL PHP extension is required by Yii2.');
|
||||
}
|
||||
|
||||
$params = getParams();
|
||||
$root = str_replace('\\', '/', __DIR__);
|
||||
$envs = require("$root/environments/index.php");
|
||||
$envNames = array_keys($envs);
|
||||
|
||||
echo "Yii Application Initialization Tool v1.0\n\n";
|
||||
|
||||
$envName = null;
|
||||
if (empty($params['env']) || $params['env'] === '1') {
|
||||
echo "Which environment do you want the application to be initialized in?\n\n";
|
||||
foreach ($envNames as $i => $name) {
|
||||
echo " [$i] $name\n";
|
||||
}
|
||||
echo "\n Your choice [0-" . (count($envs) - 1) . ', or "q" to quit] ';
|
||||
$answer = trim(fgets(STDIN));
|
||||
|
||||
if (!ctype_digit($answer) || !in_array($answer, range(0, count($envs) - 1))) {
|
||||
echo "\n Quit initialization.\n";
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (isset($envNames[$answer])) {
|
||||
$envName = $envNames[$answer];
|
||||
}
|
||||
} else {
|
||||
$envName = $params['env'];
|
||||
}
|
||||
|
||||
if (!in_array($envName, $envNames)) {
|
||||
$envsList = implode(', ', $envNames);
|
||||
echo "\n $envName is not a valid environment. Try one of the following: $envsList. \n";
|
||||
exit(2);
|
||||
}
|
||||
|
||||
$env = $envs[$envName];
|
||||
|
||||
if (empty($params['env'])) {
|
||||
echo "\n Initialize the application under '{$envNames[$answer]}' environment? [yes|no] ";
|
||||
$answer = trim(fgets(STDIN));
|
||||
if (strncasecmp($answer, 'y', 1)) {
|
||||
echo "\n Quit initialization.\n";
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
echo "\n Start initialization ...\n\n";
|
||||
$files = getFileList("$root/environments/{$env['path']}");
|
||||
if (isset($env['skipFiles'])) {
|
||||
$skipFiles = $env['skipFiles'];
|
||||
array_walk($skipFiles, function(&$value) use($env, $root) { $value = "$root/$value"; });
|
||||
$files = array_diff($files, array_intersect_key($env['skipFiles'], array_filter($skipFiles, 'file_exists')));
|
||||
}
|
||||
$all = false;
|
||||
foreach ($files as $file) {
|
||||
if (!copyFile($root, "environments/{$env['path']}/$file", $file, $all, $params)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$callbacks = ['setCookieValidationKey', 'setWritable', 'setExecutable', 'createSymlink'];
|
||||
foreach ($callbacks as $callback) {
|
||||
if (!empty($env[$callback])) {
|
||||
$callback($root, $env[$callback]);
|
||||
}
|
||||
}
|
||||
|
||||
echo "\n ... initialization completed.\n\n";
|
||||
|
||||
function getFileList($root, $basePath = '')
|
||||
{
|
||||
$files = [];
|
||||
$handle = opendir($root);
|
||||
while (($path = readdir($handle)) !== false) {
|
||||
if ($path === '.git' || $path === '.svn' || $path === '.' || $path === '..') {
|
||||
continue;
|
||||
}
|
||||
$fullPath = "$root/$path";
|
||||
$relativePath = $basePath === '' ? $path : "$basePath/$path";
|
||||
if (is_dir($fullPath)) {
|
||||
$files = array_merge($files, getFileList($fullPath, $relativePath));
|
||||
} else {
|
||||
$files[] = $relativePath;
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
return $files;
|
||||
}
|
||||
|
||||
function copyFile($root, $source, $target, &$all, $params)
|
||||
{
|
||||
if (!is_file($root . '/' . $source)) {
|
||||
echo " skip $target ($source not exist)\n";
|
||||
return true;
|
||||
}
|
||||
if (is_file($root . '/' . $target)) {
|
||||
if (file_get_contents($root . '/' . $source) === file_get_contents($root . '/' . $target)) {
|
||||
echo " unchanged $target\n";
|
||||
return true;
|
||||
}
|
||||
if ($all) {
|
||||
echo " overwrite $target\n";
|
||||
} else {
|
||||
echo " exist $target\n";
|
||||
echo " ...overwrite? [Yes|No|All|Quit] ";
|
||||
|
||||
|
||||
$answer = !empty($params['overwrite']) ? $params['overwrite'] : trim(fgets(STDIN));
|
||||
if (!strncasecmp($answer, 'q', 1)) {
|
||||
return false;
|
||||
} else {
|
||||
if (!strncasecmp($answer, 'y', 1)) {
|
||||
echo " overwrite $target\n";
|
||||
} else {
|
||||
if (!strncasecmp($answer, 'a', 1)) {
|
||||
echo " overwrite $target\n";
|
||||
$all = true;
|
||||
} else {
|
||||
echo " skip $target\n";
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
file_put_contents($root . '/' . $target, file_get_contents($root . '/' . $source));
|
||||
return true;
|
||||
}
|
||||
echo " generate $target\n";
|
||||
@mkdir(dirname($root . '/' . $target), 0777, true);
|
||||
file_put_contents($root . '/' . $target, file_get_contents($root . '/' . $source));
|
||||
return true;
|
||||
}
|
||||
|
||||
function getParams()
|
||||
{
|
||||
$rawParams = [];
|
||||
if (isset($_SERVER['argv'])) {
|
||||
$rawParams = $_SERVER['argv'];
|
||||
array_shift($rawParams);
|
||||
}
|
||||
|
||||
$params = [];
|
||||
foreach ($rawParams as $param) {
|
||||
if (preg_match('/^--(\w+)(=(.*))?$/', $param, $matches)) {
|
||||
$name = $matches[1];
|
||||
$params[$name] = isset($matches[3]) ? $matches[3] : true;
|
||||
} else {
|
||||
$params[] = $param;
|
||||
}
|
||||
}
|
||||
return $params;
|
||||
}
|
||||
|
||||
function setWritable($root, $paths)
|
||||
{
|
||||
foreach ($paths as $writable) {
|
||||
echo " chmod 0777 $writable\n";
|
||||
@chmod("$root/$writable", 0777);
|
||||
}
|
||||
}
|
||||
|
||||
function setExecutable($root, $paths)
|
||||
{
|
||||
foreach ($paths as $executable) {
|
||||
echo " chmod 0755 $executable\n";
|
||||
@chmod("$root/$executable", 0755);
|
||||
}
|
||||
}
|
||||
|
||||
function setCookieValidationKey($root, $paths)
|
||||
{
|
||||
foreach ($paths as $file) {
|
||||
echo " generate cookie validation key in $file\n";
|
||||
$file = $root . '/' . $file;
|
||||
$length = 32;
|
||||
$bytes = openssl_random_pseudo_bytes($length);
|
||||
$key = strtr(substr(base64_encode($bytes), 0, $length), '+/=', '_-.');
|
||||
$content = preg_replace('/(("|\')cookieValidationKey("|\')\s*=>\s*)(""|\'\')/', "\\1'$key'", file_get_contents($file));
|
||||
file_put_contents($file, $content);
|
||||
}
|
||||
}
|
||||
|
||||
function createSymlink($root, $links) {
|
||||
foreach ($links as $link => $target) {
|
||||
echo " symlink " . $root . "/" . $target . " " . $root . "/" . $link . "\n";
|
||||
//first removing folders to avoid errors if the folder already exists
|
||||
@rmdir($root . "/" . $link);
|
||||
@symlink($root . "/" . $target, $root . "/" . $link);
|
||||
}
|
||||
}
|
20
init.bat
20
init.bat
@ -1,20 +0,0 @@
|
||||
@echo off
|
||||
|
||||
rem -------------------------------------------------------------
|
||||
rem Yii command line init script for Windows.
|
||||
rem
|
||||
rem @author Qiang Xue <qiang.xue@gmail.com>
|
||||
rem @link http://www.yiiframework.com/
|
||||
rem @copyright Copyright (c) 2008 Yii Software LLC
|
||||
rem @license http://www.yiiframework.com/license/
|
||||
rem -------------------------------------------------------------
|
||||
|
||||
@setlocal
|
||||
|
||||
set YII_PATH=%~dp0
|
||||
|
||||
if "%PHP_COMMAND%" == "" set PHP_COMMAND=php.exe
|
||||
|
||||
"%PHP_COMMAND%" "%YII_PATH%init" %*
|
||||
|
||||
@endlocal
|
18
yii
Executable file
18
yii
Executable file
@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
require(__DIR__ . '/vendor/autoload.php');
|
||||
|
||||
defined('YII_DEBUG') or define('YII_DEBUG', (boolean)getenv('YII_DEBUG'));
|
||||
defined('YII_ENV') or define('YII_ENV', getenv('YII_ENV'));
|
||||
defined('YII_APPLICATION_TYPE') or define('YII_APPLICATION_TYPE', 'cli');
|
||||
defined('YII_APPLICATION_MODULE') or define('YII_APPLICATION_MODULE', 'console');
|
||||
|
||||
require(__DIR__ . '/vendor/yiisoft/yii2/Yii.php');
|
||||
require(__DIR__ . '/common/config/bootstrap.php');
|
||||
require(__DIR__ . '/console/config/bootstrap.php');
|
||||
|
||||
$config = require __DIR__ . '/common/config/config-loader.php';
|
||||
|
||||
$application = new yii\console\Application($config);
|
||||
$exitCode = $application->run();
|
||||
exit($exitCode);
|
20
yii.bat
20
yii.bat
@ -1,20 +0,0 @@
|
||||
@echo off
|
||||
|
||||
rem -------------------------------------------------------------
|
||||
rem Yii command line bootstrap script for Windows.
|
||||
rem
|
||||
rem @author Qiang Xue <qiang.xue@gmail.com>
|
||||
rem @link http://www.yiiframework.com/
|
||||
rem @copyright Copyright (c) 2008 Yii Software LLC
|
||||
rem @license http://www.yiiframework.com/license/
|
||||
rem -------------------------------------------------------------
|
||||
|
||||
@setlocal
|
||||
|
||||
set YII_PATH=%~dp0
|
||||
|
||||
if "%PHP_COMMAND%" == "" set PHP_COMMAND=php.exe
|
||||
|
||||
"%PHP_COMMAND%" "%YII_PATH%yii" %*
|
||||
|
||||
@endlocal
|
Loading…
Reference in New Issue
Block a user