Merge pull request #3184 from peaklabs-dev/fix-redis-db-ui

Fix: Redis DB UI
This commit is contained in:
Andras Bacsai
2024-10-21 10:00:20 +02:00
committed by GitHub
9 changed files with 244 additions and 33 deletions

View File

@@ -1,5 +1,6 @@
<?php
use App\Models\EnvironmentVariable;
use App\Models\Server;
use App\Models\StandaloneClickhouse;
use App\Models\StandaloneDocker;
@@ -49,6 +50,7 @@ function create_standalone_redis($environment_id, $destination_uuid, ?array $oth
$database = new StandaloneRedis;
$database->name = generate_database_name('redis');
$database->redis_password = \Illuminate\Support\Str::password(length: 64, symbols: false);
$database->redis_username = 'default';
$database->environment_id = $environment_id;
$database->destination_id = $destination->id;
$database->destination_type = $destination->getMorphClass();
@@ -57,6 +59,20 @@ function create_standalone_redis($environment_id, $destination_uuid, ?array $oth
}
$database->save();
EnvironmentVariable::create([
'key' => 'REDIS_PASSWORD',
'value' => $database->redis_password,
'standalone_redis_id' => $database->id,
'is_shared' => false,
]);
EnvironmentVariable::create([
'key' => 'REDIS_USERNAME',
'value' => $database->redis_username,
'standalone_redis_id' => $database->id,
'is_shared' => false,
]);
return $database;
}