From 857a35195e98e3a36d20ee625361d40467caa160 Mon Sep 17 00:00:00 2001 From: Sjeng Pho Date: Wed, 21 Dec 2016 15:21:27 +0100 Subject: [PATCH] guard config in factory --- src/DeployNotifierServiceProvider.php | 2 +- src/Factory/DeployNotifierFactory.php | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/DeployNotifierServiceProvider.php b/src/DeployNotifierServiceProvider.php index c7c7a65..0fd0486 100644 --- a/src/DeployNotifierServiceProvider.php +++ b/src/DeployNotifierServiceProvider.php @@ -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')); }); diff --git a/src/Factory/DeployNotifierFactory.php b/src/Factory/DeployNotifierFactory.php index 895afb5..909a8cb 100644 --- a/src/Factory/DeployNotifierFactory.php +++ b/src/Factory/DeployNotifierFactory.php @@ -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));