Skip to content

Commit

Permalink
guard config in factory
Browse files Browse the repository at this point in the history
  • Loading branch information
Sjeng Pho committed Dec 21, 2016
1 parent 8764bfa commit 857a351
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/DeployNotifierServiceProvider.php
Expand Up @@ -22,7 +22,7 @@ public function register()
{
// bind DeployNotifierInterface
$this->app->singleton(DeployNotifierInterface::class, function ($app) {
$deployNotifierFactory = new DeployNotifierFactory(config('deploy-notifier.notifiers'));
$deployNotifierFactory = new DeployNotifierFactory(config('deploy-notifier.notifiers', []));

return $deployNotifierFactory->create(config('deploy-notifier.settings.notifier'));
});
Expand Down
9 changes: 7 additions & 2 deletions src/Factory/DeployNotifierFactory.php
Expand Up @@ -43,8 +43,13 @@ public function create($type = '')
*/
private function getHipChatNotifier()
{
$roomId = $this->config['hipchat']['room_id'];
$token = $this->config['hipchat']['room_token'];
$roomId = '';
$token = '';

if (isset($this->config['hipchat'])) {
$roomId = $this->config['hipchat']['room_id'];
$token = $this->config['hipchat']['room_token'];
}

$client = new Client(new OAuth2($token));

Expand Down

0 comments on commit 857a351

Please sign in to comment.