Skip to content

Commit

Permalink
Merge pull request #247 from buggregator/issue/#74-hide-unused-feature
Browse files Browse the repository at this point in the history
Issue/#74 hide unused feature
  • Loading branch information
butschster authored Sep 2, 2024
2 parents 8312f27 + cccf19e commit 1e287da
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 1 deletion.
7 changes: 7 additions & 0 deletions app/src/Application/Bootloader/AppBootloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Psr\EventDispatcher\EventDispatcherInterface;
use Spiral\Core\InterceptableCore;
use App\Application\AppVersion;
use App\Application\Client\Settings;
use App\Application\HTTP\Interceptor\JsonResourceInterceptor;
use App\Application\HTTP\Interceptor\StringToIntParametersInterceptor;
use App\Application\HTTP\Interceptor\UuidParametersConverterInterceptor;
Expand Down Expand Up @@ -41,6 +42,12 @@ public function defineSingletons(): array
): AppVersion => new AppVersion(
version: $env->get('APP_VERSION', 'dev'),
),

Settings::class => fn(
EnvironmentInterface $env,
): Settings => new Settings(
supportedEvents: $env->get('CLIENT_SUPPORTED_EVENTS', 'http-dump,inspector,monolog,profiler,ray,sentry,smtp,var-dump'),
),
];
}

Expand Down
15 changes: 15 additions & 0 deletions app/src/Application/Client/Settings.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

declare(strict_types=1);

namespace App\Application\Client;

use Spiral\Core\Attribute\Singleton;

#[Singleton]
final readonly class Settings
{
public function __construct(
public string $supportedEvents,
) {}
}
7 changes: 7 additions & 0 deletions app/src/Interfaces/Http/Controller/SettingsAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use App\Application\HTTP\Response\JsonResource;
use App\Application\HTTP\Response\ResourceInterface;
use App\Application\Ide\UrlTemplate;
use App\Application\Client\Settings;
use Spiral\Boot\EnvironmentInterface;
use Spiral\Router\Annotation\Route;

Expand All @@ -20,7 +21,10 @@ public function __invoke(
AuthSettings $settings,
UrlTemplate $ideUrl,
AppVersion $appVersion,
Settings $clientSettings,
): ResourceInterface {
$supportedEvents = \array_filter(\explode(',', $clientSettings->supportedEvents));

return new JsonResource([
'auth' => [
'enabled' => $settings->enabled,
Expand All @@ -30,6 +34,9 @@ public function __invoke(
'url_template' => $ideUrl->template,
],
'version' => $appVersion->version,
'client' => [
'events' => $supportedEvents,
]
]);
}
}
7 changes: 6 additions & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,18 @@ services:
AUTH_CLIENT_SECRET: ${AUTH_CLIENT_SECRET}
AUTH_CALLBACK_URL: http://buggregator.localhost/auth/sso/callback
AUTH_SCOPES: openid,email,profile

# Client
CLIENT_SUPPORTED_EVENTS: http-dump,inspector,monolog,profiler,ray,sentry,smtp,var-dump
labels:
- "traefik.enable=true"
- "traefik.http.routers.buggregator-http.entrypoints=web"
- "traefik.http.routers.buggregator-http.rule=Host(`buggregator.localhost`)"
- "traefik.http.services.buggregator-http.loadbalancer.server.port=8000"
volumes:
- ./:/app
- ./app:/app/app
- ./runtime:/app/runtime
- ./vendor:/app/vendor
networks:
- buggregator-network

Expand Down

0 comments on commit 1e287da

Please sign in to comment.