Commit c22d5dc209a2f39553ad9f9ac2588a4e3355df47
1 parent
e33705c67b
Exists in
master
and in
3 other branches
Enable/disable authentication middleware dynamically
Showing 2 changed files with 6 additions and 4 deletions
api/.env.example
View file @
c22d5dc
api/routes/api.php
View file @
c22d5dc
... | ... | @@ -13,7 +13,9 @@ |
13 | 13 | | |
14 | 14 | */ |
15 | 15 | |
16 | -//Route::group(['middleware' => 'auth:api'], function () { | |
16 | +$parameters = env('AUTH_ENABLED') ? ['middleware' => 'auth:api'] : []; | |
17 | + | |
18 | +Route::group($parameters, function () { | |
17 | 19 | Route::get('config', 'ConfigController@index'); |
18 | 20 | Route::get('capec', 'CapecController@index'); |
19 | 21 | Route::group(['prefix' => 'v1'], function () { |
... | ... | @@ -35,7 +37,7 @@ |
35 | 37 | Route::get('events/group','V1\Components\MltdController@group'); |
36 | 38 | Route::get('events/last','V1\Components\MltdController@last'); |
37 | 39 | //should be last since matches to anything */* |
38 | - Route::get('{train_id}/{top}', 'V1\Components\MltdController@train'); | |
40 | + Route::get('{train_id}/{top}', 'V1\Components\MltdController@train'); | |
39 | 41 | }); |
40 | 42 | Route::group(['prefix' => 'od'], function () { |
41 | 43 | Route::get('start', 'V1\Components\OdController@start'); |
... | ... | @@ -47,6 +49,5 @@ |
47 | 49 | Route::get('events/last','V1\Components\OdController@last'); |
48 | 50 | }); |
49 | 51 | }); |
50 | - | |
51 | -//}); | |
52 | +}); |