Skip to content

Commit

Permalink
Added LogViewer
Browse files Browse the repository at this point in the history
  • Loading branch information
VampireAotD committed Jul 7, 2024
1 parent 1225f3e commit aedbf5d
Show file tree
Hide file tree
Showing 10 changed files with 517 additions and 35 deletions.
6 changes: 6 additions & 0 deletions src/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,9 @@ ELASTICSEARCH_PASSWORD=example
ELASTICSEARCH_HOST=localhost
ELASTICSEARCH_PORT=9200
ELASTICSEARCH_SCHEME=http

LOG_VIEWER_ENABLED=true
LOG_VIEWER_API_ONLY=false
LOG_VIEWER_ROUTE_PATH=log-viewer
LOG_VIEWER_CACHE_DRIVER=
LOG_VIEWER_API_STATEFUL_DOMAINS=
12 changes: 12 additions & 0 deletions src/.env.testing
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,15 @@ JWT_SECRET=test
SCRAPER_URL=http://test-scraper

LOGSTASH_ADDRESS=udp://test-logstash:12201

ELASTICSEARCH_USER=test
ELASTICSEARCH_PASSWORD=test
ELASTICSEARCH_HOST=localhost
ELASTICSEARCH_PORT=9200
ELASTICSEARCH_SCHEME=http

LOG_VIEWER_ENABLED=true
LOG_VIEWER_API_ONLY=false
LOG_VIEWER_ROUTE_PATH=log-viewer
LOG_VIEWER_CACHE_DRIVER=
LOG_VIEWER_API_STATEFUL_DOMAINS=
31 changes: 31 additions & 0 deletions src/app/Providers/LogViewerServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

declare(strict_types=1);

namespace App\Providers;

use App\Enums\RoleEnum;
use App\Models\User;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\ServiceProvider;

class LogViewerServiceProvider extends ServiceProvider
{
/**
* Register services.
*/
public function register(): void
{
//
}

/**
* Bootstrap services.
*/
public function boot(): void
{
Gate::define('viewLogViewer', function (?User $user) {
return $user->hasRole(RoleEnum::OWNER);
});
}
}
1 change: 1 addition & 0 deletions src/bootstrap/providers.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
App\Providers\FacadeServiceProvider::class,
App\Providers\FakerServiceProvider::class,
App\Providers\HorizonServiceProvider::class,
App\Providers\LogViewerServiceProvider::class,
App\Providers\MacroServiceProvider::class,
App\Providers\RouteServiceProvider::class,
];
4 changes: 4 additions & 0 deletions src/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"laravel/sanctum": "^4.0",
"laravel/tinker": "^2.9",
"nutgram/laravel": "^1.4",
"opcodesio/log-viewer": "^3.10",
"predis/predis": "^2.2",
"pusher/pusher-php-server": "^7.2",
"spatie/laravel-permission": "^6.7",
Expand Down Expand Up @@ -69,10 +70,13 @@
"@php artisan package:discover --ansi"
],
"post-install-cmd": [
"@php artisan vendor:publish --tag=laravel-assets --ansi",
"@php artisan vendor:publish --tag=log-viewer-assets --ansi",
"@ide-helper"
],
"post-update-cmd": [
"@php artisan vendor:publish --tag=laravel-assets --ansi",
"@php artisan vendor:publish --tag=log-viewer-assets --ansi",
"@ide-helper"
],
"post-root-package-install": [
Expand Down
143 changes: 142 additions & 1 deletion src/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit aedbf5d

Please sign in to comment.