Skip to content

Commit

Permalink
Merge configuration if not published
Browse files Browse the repository at this point in the history
  • Loading branch information
owenvoke committed Jun 3, 2019
1 parent a61068d commit 4afe65e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Laravel/ArionumServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
namespace pxgamer\Arionum\Laravel;

use pxgamer\Arionum\Arionum;
use pxgamer\Arionum\Exceptions\InvalidNodeUriException;
use Illuminate\Support\ServiceProvider;
use pxgamer\Arionum\Exceptions\InvalidNodeUriException;

final class ArionumServiceProvider extends ServiceProvider
{
Expand All @@ -13,12 +13,14 @@ public function boot(): void
$this->publishes([
__DIR__.'/config/arionum.php' => $this->app->configPath('arionum.php'),
], 'config');

$this->mergeConfigFrom(__DIR__.'/config/arionum.php', 'arionum');
}

public function register(): void
{
$this->app->singleton(Arionum::class, function () {
if (!$this->app->get('config')->get('arionum.node-uri')) {
if (! $this->app->get('config')->get('arionum.node-uri')) {
throw new InvalidNodeUriException('The configured node uri is invalid. A valid `ARIONUM_NODE_URI` variable should be configured in your environment');
}

Expand Down

0 comments on commit 4afe65e

Please sign in to comment.