Skip to content

Commit

Permalink
improved building configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
hiqsol committed Sep 27, 2017
1 parent d3382b7 commit 43aeed3
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 15 deletions.
12 changes: 6 additions & 6 deletions src/config/common.php
Expand Up @@ -25,12 +25,12 @@
],
],
],
'sentry' => array_filter([
'class' => \mito\sentry\Component::class,
'enabled' => $params['sentry.enabled'],
'dsn' => $params['sentry.dsn'],
'environment' => $env,
]),
'sentry' => [
'class' => \mito\sentry\Component::class,
'enabled' => $params['sentry.enabled'],
'dsn' => $params['sentry.dsn'],
'environment' => $params['sentry.environment'],
],
]),
'modules' => [
'monitoring' => [
Expand Down
29 changes: 20 additions & 9 deletions src/config/params.php
Expand Up @@ -8,15 +8,26 @@
* @copyright Copyright (c) 2017, HiQDev (http://hiqdev.com/)
*/

return [
'adminEmail' => null,
$env = defined('YII_ENV') ? YII_ENV : 'prod';

'monitoring.flag' => \hiqdev\yii2\monitoring\Module::FLAG_APPLICATION,
'monitoring.feedback.subject' => 'Error feedback',
'monitoring.email.subject' => null,
'monitoring.email.from' => null,
'monitoring.email.to' => null,
$defaults = [
'adminEmail' => null,

'sentry.dsn' => null,
'sentry.enabled' => null,
'monitoring.flag' => \hiqdev\yii2\monitoring\Module::FLAG_APPLICATION,
'monitoring.feedback.subject' => 'Error feedback',
'monitoring.email.subject' => null,
'monitoring.email.from' => null,
'monitoring.email.to' => null,

'sentry.dsn' => null,
'sentry.enabled' => $env === 'prod',
'sentry.environment' => $env,
];

$params = [];
foreach ($defaults as $key => $default) {
$envKey = strtoupper(strtr($key, '.', '_'));
$params[$key] = isset($_ENV[$envKey]) ? $_ENV[$envKey] : $default;
}

return $params;

0 comments on commit 43aeed3

Please sign in to comment.