Skip to content

Commit

Permalink
Allow config files to be published seperately
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexVanderbist committed Mar 17, 2022
1 parent 1b487d2 commit df270eb
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions src/IgnitionServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,25 +87,28 @@ protected function registerCommands(): void
protected function publishConfigs(): void
{
$this->publishes([
__DIR__ . '/../config/flare.php' => config_path('flare.php'),
__DIR__ . '/../config/ignition.php' => config_path('ignition.php'),
]);
], 'ignition-config');

$this->publishes([
__DIR__ . '/../config/flare.php' => config_path('flare.php'),
], 'flare-config');
}

protected function registerRenderer(): void
{
if (interface_exists('Whoops\Handler\HandlerInterface')) {
$this->app->bind(
'Whoops\Handler\HandlerInterface',
fn (Application $app) => $app->make(IgnitionWhoopsHandler::class)
fn(Application $app) => $app->make(IgnitionWhoopsHandler::class)
);
}


if (interface_exists('Illuminate\Contracts\Foundation\ExceptionRenderer')) {
$this->app->bind(
'Illuminate\Contracts\Foundation\ExceptionRenderer',
fn (Application $app) => $app->make(IgnitionExceptionRenderer::class)
fn(Application $app) => $app->make(IgnitionExceptionRenderer::class)
);
}
}
Expand Down Expand Up @@ -134,11 +137,11 @@ protected function registerIgnition(): void
$solutionProviders = $this->getSolutionProviders();
$solutionProviderRepository = new SolutionProviderRepository($solutionProviders);

$this->app->singleton(IgnitionConfig::class, fn () => $ignitionConfig);
$this->app->singleton(IgnitionConfig::class, fn() => $ignitionConfig);

$this->app->singleton(SolutionProviderRepositoryContract::class, fn () => $solutionProviderRepository);
$this->app->singleton(SolutionProviderRepositoryContract::class, fn() => $solutionProviderRepository);

$this->app->singleton(Ignition::class, fn () => (new Ignition()));
$this->app->singleton(Ignition::class, fn() => (new Ignition()));
}

protected function registerRecorders(): void
Expand Down Expand Up @@ -173,7 +176,7 @@ function (Application $app): QueryRecorder {

public function configureTinker(): void
{
if (! $this->app->runningInConsole()) {
if (!$this->app->runningInConsole()) {
if (isset($_SERVER['argv']) && ['artisan', 'tinker'] === $_SERVER['argv']) {
app(Flare::class)->sendReportsImmediately();
}
Expand All @@ -191,7 +194,7 @@ protected function registerViewExceptionMapper(): void
{
$handler = $this->app->make(ExceptionHandler::class);

if (! method_exists($handler, 'map')) {
if (!method_exists($handler, 'map')) {
return;
}

Expand Down Expand Up @@ -221,11 +224,11 @@ protected function registerLogHandler(): void

return tap(
new Logger('Flare'),
fn (Logger $logger) => $logger->pushHandler($handler)
fn(Logger $logger) => $logger->pushHandler($handler)
);
});

Log::extend('flare', fn ($app) => $app['flare.logger']);
Log::extend('flare', fn($app) => $app['flare.logger']);
}

protected function startRecorders(): void
Expand All @@ -243,7 +246,7 @@ protected function startRecorders(): void

protected function configureQueue(): void
{
if (! $this->app->bound('queue')) {
if (!$this->app->bound('queue')) {
return;
}

Expand All @@ -267,7 +270,7 @@ protected function getLogLevel(string $logLevelString): int
{
$logLevel = Logger::getLevels()[strtoupper($logLevelString)] ?? null;

if (! $logLevel) {
if (!$logLevel) {
throw InvalidConfig::invalidLogLevel($logLevelString);
}

Expand Down Expand Up @@ -296,7 +299,7 @@ protected function getSolutionProviders(): array
{
return collect(config('ignition.solution_providers'))
->reject(
fn (string $class) => in_array($class, config('ignition.ignored_solution_providers'))
fn(string $class) => in_array($class, config('ignition.ignored_solution_providers'))
)
->toArray();
}
Expand Down

0 comments on commit df270eb

Please sign in to comment.