Skip to content

Commit

Permalink
Add environment specification to the channel
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasMahe committed Jan 22, 2016
1 parent 8c05de1 commit 9d144b7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
12 changes: 9 additions & 3 deletions src/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,16 @@ class Service
*/
function __construct(array $config)
{
$env = app()->environment();
$channel = $config["channel"]['local'];
if (isset($config["channel"][$env])) {
$channel = $config["channel"][$env];
}

//config
$this->channel_job_failed = $config["channel"]["job_failed"];
$this->channel_scheduled_command = $config["channel"]["scheduled_command"];
$this->channel_exception = $config["channel"]["exception"];
$this->channel_job_failed = $channel["job_failed"];
$this->channel_scheduled_command = $channel["scheduled_command"];
$this->channel_exception = $channel["exception"];
}

/**
Expand Down
20 changes: 15 additions & 5 deletions src/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,27 @@
|
| The channels we should post to. The channel can either be a
| channel like #general, a private #group, or a @username. Set to
| null to use the default set on the Slack webhook
| null to use the default set on the Slack webhook.
|
| The production and local are corresponding to the app environment.
| You can add any app environment to this array.
| The default (if not exist) will be the local.
|
*/

'channel' => [
"job_failed" => "",
"scheduled_command" => "",
"exception" => "",
"production" => [
"job_failed" => "",
"scheduled_command" => "",
"exception" => "",
],
"local" => [
"job_failed" => "",
"scheduled_command" => "",
"exception" => "",
],
],


/*
|-------------------------------------------------------------
| Default username
Expand Down

0 comments on commit 9d144b7

Please sign in to comment.