Route name to configs (#4)

This commit is contained in:
nope7777 2019-01-16 12:32:48 +02:00 committed by Nic Appleby
parent c0c0258cde
commit 26842ebdb7
2 changed files with 20 additions and 1 deletions

View file

@ -39,6 +39,19 @@ return [
'metrics_route_path' => env('PROMETHEUS_METRICS_ROUTE_PATH', 'metrics'), 'metrics_route_path' => env('PROMETHEUS_METRICS_ROUTE_PATH', 'metrics'),
/*
|--------------------------------------------------------------------------
| Metrics Route Name
|--------------------------------------------------------------------------
|
| Route Parh name aliase.
|
| This is only applicable if metrics_route_enabled is set to true.
|
*/
'metrics_route_name' => env('PROMETHEUS_METRICS_ROUTE_NAME', 'metrics'),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Metrics Route Middleware | Metrics Route Middleware

View file

@ -1,9 +1,15 @@
<?php <?php
/** @var \Illuminate\Routing\Route $route */
$route = Route::get( $route = Route::get(
config('prometheus.metrics_route_path'), config('prometheus.metrics_route_path'),
\Superbalist\LaravelPrometheusExporter\MetricsController::class . '@getMetrics' \Superbalist\LaravelPrometheusExporter\MetricsController::class . '@getMetrics'
)->name('metrics'); /** @var \Illuminate\Routing\Route $route */ );
if ($name = config('prometheus.metrics_route_name')) {
$route->name($name);
}
$middleware = config('prometheus.metrics_route_middleware'); $middleware = config('prometheus.metrics_route_middleware');
if ($middleware) { if ($middleware) {