@extends('layouts.admin') @php $providers = collect(); $providerEngines = []; $dashboardSettings = app(\Pterodactyl\BlueprintFramework\Extensions\betterdatabases\Services\Databases\Providers\DatabaseDashboardSettingsService::class); $sqlDashboardSettings = $dashboardSettings->all(); $redisAllocationsEnabled = $sqlDashboardSettings['redis_allocations_enabled']; if (class_exists(\Pterodactyl\BlueprintFramework\Extensions\betterdatabases\Models\DatabaseProvider::class)) { $providerEngines = [ \Pterodactyl\BlueprintFramework\Extensions\betterdatabases\Models\DatabaseProvider::ENGINE_MYSQL => 'MySQL / MariaDB', \Pterodactyl\BlueprintFramework\Extensions\betterdatabases\Models\DatabaseProvider::ENGINE_POSTGRESQL => 'PostgreSQL', \Pterodactyl\BlueprintFramework\Extensions\betterdatabases\Models\DatabaseProvider::ENGINE_MONGODB => 'MongoDB', \Pterodactyl\BlueprintFramework\Extensions\betterdatabases\Models\DatabaseProvider::ENGINE_REDIS => 'Redis', ]; try { $providers = \Pterodactyl\BlueprintFramework\Extensions\betterdatabases\Models\DatabaseProvider::query() ->with('node') ->withCount('allocations') ->orderBy('engine') ->orderBy('name') ->get(); } catch (\Throwable $exception) { $providers = collect(); } } $providerRoutesLoaded = \Illuminate\Support\Facades\Route::has('admin.extensions.betterdatabases.post'); $providerSettingsRouteLoaded = \Illuminate\Support\Facades\Route::has('admin.extensions.betterdatabases.patch'); $providerStoreAction = route('admin.extensions.betterdatabases.post'); $panelRedisPassword = config('database.redis.default.password'); $panelRedisPasswordMissing = $panelRedisPassword === null || $panelRedisPassword === '' || strtolower((string) $panelRedisPassword) === 'null'; $nativeHostCount = count($hosts); $providerCount = $providers->count(); @endphp @section('title') Better Databases @endsection @section('content-header')

Better DatabasesProvider setup and SQL dashboard settings.

@endsection @section('content')
@if($panelRedisPasswordMissing)
Main Redis has no password

Set REDIS_PASSWORD and keep port 6379 private before exposing Redis-related features.

@endif
Redis allocations are {{ $redisAllocationsEnabled ? 'enabled' : 'disabled' }}

{{ $redisAllocationsEnabled ? 'Use only with private networking, generated passwords, memory limits, and one Redis process per allocation.' : 'Recommended default. Enable only for trusted infrastructure with isolated Redis allocation processes.' }}

@if($providerSettingsRouteLoaded)
{!! csrf_field() !!}

Feature Gates Backend enforced API access

@php $settingToggles = [ 'provider_mysql_enabled' => ['MySQL providers', 'Addon-managed MySQL/MariaDB databases.'], 'provider_postgresql_enabled' => ['PostgreSQL providers', 'Isolated PostgreSQL databases and users.'], 'provider_mongodb_enabled' => ['MongoDB providers', 'Isolated MongoDB databases and users.'], 'redis_allocations_enabled' => ['Redis providers', 'Tenant Redis processes. Keep off unless trusted.'], 'raw_sql_enabled' => ['Raw SQL console', 'Manual SQL endpoints for SQL dashboards.'], 'imports_enabled' => ['Imports', 'Upload, preview, chunked, and external imports.'], 'exports_enabled' => ['Exports', 'Full and selective database downloads.'], ]; @endphp @foreach($settingToggles as $settingKey => [$settingLabel, $settingHelp]) @endforeach
@endif

Connections {{ $nativeHostCount }} native, {{ $providerCount }} provider{{ $providerCount === 1 ? '' : 's' }}

@if($providerRoutesLoaded) @endif
@foreach ($hosts as $host) @endforeach @foreach ($providers as $provider) @php $providerConnectionDatabase = null; $providerConnectionDatabaseLabel = null; if ($provider->engine === \Pterodactyl\BlueprintFramework\Extensions\betterdatabases\Models\DatabaseProvider::ENGINE_MONGODB) { $providerConnectionDatabase = array_get($provider->options ?? [], 'auth_database') ?: ($provider->database ?: 'admin'); $providerConnectionDatabaseLabel = 'Auth DB'; } @endphp @endforeach @if(count($hosts) < 1 && count($providers) < 1) @endif
Name Endpoint Engine Scope Usage Status Actions
{{ $host->name }} Native host {{ $host->id }} {{ $host->host }}:{{ $host->port }} User {{ $host->username }} MySQL / MariaDB @if(! is_null($host->node)) {{ $host->node->name }} @else None @endif {{ $host->databases_count }} Enabled Manage
{{ $provider->name }} Provider p{{ $provider->id }} {{ $provider->host }}:{{ $provider->port }} @if($providerConnectionDatabaseLabel) {{ $providerConnectionDatabaseLabel }} {{ $providerConnectionDatabase }} @endif @if($provider->username) @if($providerConnectionDatabaseLabel) · @endif User {{ $provider->username }} @endif @if($providerConnectionDatabaseLabel || $provider->username) · @endif TLS {{ array_get($provider->options ?? [], 'tls') ? 'on' : 'off' }} {{ $providerEngines[$provider->engine] ?? $provider->engine }} @if(array_get($provider->options ?? [], 'tls')) TLS @endif @if(! is_null($provider->node)) {{ $provider->node->name }} @else Global @endif @if($provider->engine === \Pterodactyl\BlueprintFramework\Extensions\betterdatabases\Models\DatabaseProvider::ENGINE_REDIS) @php $redisOptions = $provider->options ?? []; $redisStart = array_get($redisOptions, 'redis_port_start'); $redisEnd = array_get($redisOptions, 'redis_port_end'); $redisCapacity = $redisStart && $redisEnd ? ($redisEnd - $redisStart + 1) : 0; $redisMax = array_get($redisOptions, 'redis_max_instances') ?: $redisCapacity; $redisUsed = \Pterodactyl\BlueprintFramework\Extensions\betterdatabases\Models\DatabaseProviderAllocation::query() ->where('database_provider_id', $provider->id) ->where('engine', \Pterodactyl\BlueprintFramework\Extensions\betterdatabases\Models\DatabaseProvider::ENGINE_REDIS) ->count(); @endphp @if($redisStart && $redisEnd) {{ $redisUsed }} / {{ $redisMax }} @if(!$redisAllocationsEnabled) Global off @endif @if(empty($redisOptions['redis_enable_allocations'])) Allocations off @endif @else Range needed @endif @else {{ $provider->allocations_count }} @endif @if($provider->enabled) Enabled @else Disabled @endif @if($providerRoutesLoaded)
{!! csrf_field() !!}
@else Read only @endif
No database connections have been configured.
@php $providerDefaults = [ 'engine' => old('engine', 'mysql'), 'port' => old('port', 3306), 'options' => [], 'enabled' => true, 'node_id' => null, ]; @endphp @include('admin.extensions.betterdatabases.partials.provider-modal', [ 'modalId' => 'newProviderModal', 'title' => 'Add Database Provider', 'action' => $providerStoreAction, 'method' => 'POST', 'provider' => null, 'providerDefaults' => $providerDefaults, 'providerEngines' => $providerEngines, 'locations' => $locations, ]) @foreach($providers as $provider) @include('admin.extensions.betterdatabases.partials.provider-modal', [ 'modalId' => 'providerModal' . $provider->id, 'title' => 'Edit Database Provider', 'action' => route('admin.extensions.betterdatabases.put'), 'method' => 'PATCH', 'provider' => $provider, 'providerDefaults' => $providerDefaults, 'providerEngines' => $providerEngines, 'locations' => $locations, ]) @endforeach @endsection @section('footer-scripts') @parent @endsection