From 2328f83810eef03997cf7f044b52aee5e370440c Mon Sep 17 00:00:00 2001 From: Egorka Date: Mon, 3 Sep 2018 20:19:01 +0300 Subject: [PATCH] Environments update --- environments/dev/backend/config/params-local.php | 5 ++ environments/dev/common/config/params-local.php | 17 +++--- environments/dev/frontend/config/main-local.php | 60 +++++++++++++++------ environments/prod/backend/config/params-local.php | 5 ++ environments/prod/common/config/params-local.php | 15 ++++-- environments/prod/frontend/config/main-local.php | 65 +++++++++++++---------- setup.php | 6 ++- 7 files changed, 116 insertions(+), 57 deletions(-) diff --git a/environments/dev/backend/config/params-local.php b/environments/dev/backend/config/params-local.php index d0b9c34..e9a7d00 100644 --- a/environments/dev/backend/config/params-local.php +++ b/environments/dev/backend/config/params-local.php @@ -1,3 +1,8 @@ [ + 'ru' => 'Русский', + 'en' => 'English', + ], + 'backendDefaultLanguage' => 'ru', ]; diff --git a/environments/dev/common/config/params-local.php b/environments/dev/common/config/params-local.php index 02c1db4..a2bcdf9 100644 --- a/environments/dev/common/config/params-local.php +++ b/environments/dev/common/config/params-local.php @@ -1,10 +1,13 @@ '', - 'cookieDomain' => '.domain.local', - 'frontendHostInfo' => 'http://domain.local', - 'backendHostInfo' => 'http://admin.domain.local', - 'staticHostInfo' => 'http://static.domain.local', - 'mailChimpKey' => '', - 'mailChimpListId' => '', + 'cookieValidationKey' => '', + 'cookieDomain' => '.morework.local', + 'staticPath' => dirname(__DIR__, 2) . '/static', + 'frontendHostInfo' => 'http://morework.local', + 'backendHostInfo' => 'http://admin.morework.local', + 'staticHostInfo' => 'http://static.morework.local', + 'supportEmail' => 'support@morework.local', + 'adminEmail' => 'admin@morework.local', + 'mailChimpKey' => '', + 'mailChimpListId' => '', ]; diff --git a/environments/dev/frontend/config/main-local.php b/environments/dev/frontend/config/main-local.php index cabb093..1f6187a 100644 --- a/environments/dev/frontend/config/main-local.php +++ b/environments/dev/frontend/config/main-local.php @@ -1,30 +1,58 @@ [ - 'authClientCollection' => [ - 'class' => 'yii\authclient\Collection', - 'clients' => [ - 'vk' => [ - 'class' => 'yii\authclient\clients\VKontakte', - 'clientId' => '', - 'clientSecret' => '', - ], - ], - ] - ], + 'components' => [ + 'view' => [ + 'theme' => [ + 'basePath' => '@webroot/themes/sport', + 'baseUrl' => '@web/themes/sport', + 'pathMap' => [ + '@frontend/views' => '@webroot/themes/sport', + '@frontend/widgets' => '@webroot/themes/sport/widgets', + ], + ], + ], + + 'authClientCollection' => [ + 'class' => 'yii\authclient\Collection', + 'clients' => [ + 'yandex' => [ + 'class' => 'yii\authclient\clients\Yandex', + 'clientId' => '', + 'clientSecret' => '', + ], + 'google' => [ + 'class' => 'yii\authclient\clients\Google', + 'clientId' => '', + 'clientSecret' => '', + ], + 'facebook' => [ + 'class' => 'yii\authclient\clients\Facebook', + 'clientId' => '', + 'clientSecret' => '', + ], + 'vk' => [ + 'class' => 'yii\authclient\clients\VKontakte', + 'clientId' => '', + 'clientSecret' => '', + ], + ], + ] + ], ]; if (!YII_ENV_TEST) { // configuration adjustments for 'dev' environment - $config['bootstrap'][] = 'debug'; + $config['bootstrap'][] = 'debug'; $config['modules']['debug'] = [ - 'class' => 'yii\debug\Module', + 'class' => 'yii\debug\Module', + 'allowedIPs' => ['*'], ]; - $config['bootstrap'][] = 'gii'; + $config['bootstrap'][] = 'gii'; $config['modules']['gii'] = [ - 'class' => 'yii\gii\Module', + 'class' => 'yii\gii\Module', + 'allowedIPs' => ['*'], ]; } diff --git a/environments/prod/backend/config/params-local.php b/environments/prod/backend/config/params-local.php index d0b9c34..e9a7d00 100644 --- a/environments/prod/backend/config/params-local.php +++ b/environments/prod/backend/config/params-local.php @@ -1,3 +1,8 @@ [ + 'ru' => 'Русский', + 'en' => 'English', + ], + 'backendDefaultLanguage' => 'ru', ]; diff --git a/environments/prod/common/config/params-local.php b/environments/prod/common/config/params-local.php index e2cd9a0..a2bcdf9 100644 --- a/environments/prod/common/config/params-local.php +++ b/environments/prod/common/config/params-local.php @@ -1,8 +1,13 @@ '', - 'cookieDomain' => '.morework.dev', - 'frontendHostInfo' => 'http://morework.dev', - 'backendHostInfo' => 'http://admin.morework.dev', - 'staticHostInfo' => 'http://static.shop.dev', + 'cookieValidationKey' => '', + 'cookieDomain' => '.morework.local', + 'staticPath' => dirname(__DIR__, 2) . '/static', + 'frontendHostInfo' => 'http://morework.local', + 'backendHostInfo' => 'http://admin.morework.local', + 'staticHostInfo' => 'http://static.morework.local', + 'supportEmail' => 'support@morework.local', + 'adminEmail' => 'admin@morework.local', + 'mailChimpKey' => '', + 'mailChimpListId' => '', ]; diff --git a/environments/prod/frontend/config/main-local.php b/environments/prod/frontend/config/main-local.php index fe2e673..0ac79b2 100644 --- a/environments/prod/frontend/config/main-local.php +++ b/environments/prod/frontend/config/main-local.php @@ -1,33 +1,44 @@ [ - 'authClientCollection' => [ - 'class' => 'yii\authclient\Collection', - 'clients' => [ - 'yandex' => [ - 'class' => 'yii\authclient\clients\Yandex', - 'clientId' => '', - 'clientSecret' => '', - ], - 'google' => [ - 'class' => 'yii\authclient\clients\Google', - 'clientId' => '', - 'clientSecret' => '', - ], - 'facebook' => [ - 'class' => 'yii\authclient\clients\Facebook', - 'clientId' => '', - 'clientSecret' => '', - ], - 'vk' => [ - 'class' => 'yii\authclient\clients\VKontakte', - 'clientId' => '', - 'clientSecret' => '', - ], - ], - ] - ], + 'components' => [ + 'view' => [ + 'theme' => [ + 'basePath' => '@webroot/themes/sport', + 'baseUrl' => '@web/themes/sport', + 'pathMap' => [ + '@frontend/views' => '@webroot/themes/sport', + '@frontend/widgets' => '@webroot/themes/sport/widgets', + ], + ], + ], + + 'authClientCollection' => [ + 'class' => 'yii\authclient\Collection', + 'clients' => [ + 'yandex' => [ + 'class' => 'yii\authclient\clients\Yandex', + 'clientId' => '', + 'clientSecret' => '', + ], + 'google' => [ + 'class' => 'yii\authclient\clients\Google', + 'clientId' => '', + 'clientSecret' => '', + ], + 'facebook' => [ + 'class' => 'yii\authclient\clients\Facebook', + 'clientId' => '', + 'clientSecret' => '', + ], + 'vk' => [ + 'class' => 'yii\authclient\clients\VKontakte', + 'clientId' => '', + 'clientSecret' => '', + ], + ], + ] + ], ]; return $config; diff --git a/setup.php b/setup.php index 028c7d3..e7599e7 100644 --- a/setup.php +++ b/setup.php @@ -34,10 +34,10 @@ class Setup // run init if ($this->_type == 'd') { - shell_exec('php init --env=Development --overwrite=n'); + shell_exec('php ' . __DIR__ . '/init --env=Development --overwrite=n'); } else { - shell_exec('php init --env=Production --overwrite=n'); + shell_exec('php ' . __DIR__ . '/init --env=Production --overwrite=n'); } // config db @@ -145,12 +145,14 @@ class Setup $site_domain = $this->_http_protocol . '://' . $this->_domain; $admin_domain = $this->_http_protocol . '://admin.' . $this->_domain; $static_domain = $this->_http_protocol . '://static.' . $this->_domain; + $cookie_domain = '.' . $this->_domain; $content = preg_replace('/(("|\')frontendHostInfo("|\')\s*=>\s*)(""|\'\')/', "\\1'$site_domain'", $content); $content = preg_replace('/(("|\')backendHostInfo("|\')\s*=>\s*)(""|\'\')/', "\\1'$admin_domain'", $content); $content = preg_replace('/(("|\')staticHostInfo("|\')\s*=>\s*)(""|\'\')/', "\\1'$static_domain'", $content); $content = preg_replace('/(("|\')supportEmail("|\')\s*=>\s*)(""|\'\')/', "\\1'$this->_email'", $content); $content = preg_replace('/(("|\')adminEmail("|\')\s*=>\s*)(""|\'\')/', "\\1'$this->_email'", $content); + $content = preg_replace('/(("|\')cookieDomain("|\')\s*=>\s*)(""|\'\')/', "\\1'$cookie_domain'", $content); file_put_contents($file, $content); }