redirect to server show page if a gateway is not installed on a given server

This commit is contained in:
2025-04-24 19:08:21 +01:00
parent 6296c2d999
commit 46a76f7bce
7 changed files with 62 additions and 14 deletions

View File

@@ -15,4 +15,8 @@ abstract class DatabaseDriver extends Driver
?string $containerId = null,
?array $credentials = null,
);
abstract public function createUser(string $user, string $password): string;
// abstract public function createDatabase(string $db, string $user): string;
}

View File

@@ -55,7 +55,7 @@ class Postgres17Driver extends DatabaseDriver
}
),
new Step(
name: 'Configure firewall',
name: 'Configure firewall', // @todo this should create a Firewallrule
script: 'ufw allow 5432/tcp || true',
),
]);
@@ -69,4 +69,9 @@ class Postgres17Driver extends DatabaseDriver
'db' => 'keystone',
];
}
public function createUser(string $user, string $password): string
{
return "psql -U {$this->credentials['user']} -d {$this->credentials['db']} -c \"CREATE USER {$user} WITH PASSWORD '{$password}';\"";
}
}

View File

@@ -16,7 +16,13 @@ class EnvironmentController extends Controller
return inertia('environments/Show', [
'environment' => $environment,
'servers' => inertia()->optional(function () use ($environment) {
return $environment->application?->organisation?->servers->where('status', ServerStatus::ACTIVE)?->values() ?? [];
return $environment
->application
?->organisation
?->servers()
->where('status', ServerStatus::ACTIVE)
->with('services')
->get() ?? [];
}),
]);
}