Skip to content

Commit

Permalink
Remove env var
Browse files Browse the repository at this point in the history
  • Loading branch information
karlomikus committed Oct 1, 2023
1 parent 85c3cf5 commit 6b6d9f7
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 15 deletions.
1 change: 0 additions & 1 deletion .env.dist
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,4 @@ MEILISEARCH_API_KEY=

SANCTUM_STATEFUL_DOMAINS=

#DISABLE_LOGIN=true
PARENT_INGREDIENT_SUBSTITUTE=false
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@
- Updated `UserIngredient` schema
- Updated `Ingredient` schema
- Moved `parent_ingredient_id` to `parent_ingredient` object, accessible via `parent_ingredient.id`
- Removed `DISABLE_LOGIN` env variable

## New
- Meilisearch is no longer mandatory dependency for API to work
Expand All @@ -244,6 +245,8 @@
- This will remove the need to authenticate with token to access the api
- Added GET `/images` endpoint
- `ImageRequest` schema now supports `image_url` parameter to upload image from URL
- Added `MAX_USER_BARS` env variable, defaults to 50
- This limits how many bars can a single user create

## Fixes
- Fixed openapi swagger docs url
Expand Down
11 changes: 3 additions & 8 deletions config/bar-assistant.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,13 @@

/*
|--------------------------------------------------------------------------
| Disable login
| Max bars per user
|--------------------------------------------------------------------------
|
| This option will disable the need to authenticate with token to access the api
| This will limit how many bars can a single user create
|
*/

'disable_login' => env(
'DISABLE_LOGIN',
false
),

'max_default_bars' => 100,
'max_default_bars' => env('MAX_USER_BARS', 50),

];
7 changes: 1 addition & 6 deletions routes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@
|
*/

$authMiddleware = 'auth:sanctum';
if (config('bar-assistant.disable_login') === true) {
$authMiddleware = 'auth:force-login';
}

Route::get('/', [ServerController::class, 'index']);

Route::post('login', [AuthController::class, 'authenticate'])->name('auth.login');
Expand All @@ -60,7 +55,7 @@
Route::get('/cocktails/{ulid}', [ExploreController::class, 'cocktail']);
});

Route::middleware($authMiddleware)->group(function() {
Route::middleware('auth:sanctum')->group(function() {

Route::post('logout', [AuthController::class, 'logout'])->name('auth.logout');

Expand Down

0 comments on commit 6b6d9f7

Please sign in to comment.