mirror of
https://github.com/coollabsio/coolify.git
synced 2026-03-11 08:55:47 +00:00
feat: added required timeout range to database proxy
This commit is contained in:
parent
89fd4c52bc
commit
14b0160165
1 changed files with 12 additions and 1 deletions
|
|
@ -22,6 +22,17 @@ class StartDatabaseProxy
|
|||
|
||||
public function handle(StandaloneRedis|StandalonePostgresql|StandaloneMongodb|StandaloneMysql|StandaloneMariadb|StandaloneKeydb|StandaloneDragonfly|StandaloneClickhouse|ServiceDatabase $database)
|
||||
{
|
||||
// Validate proxy timeout
|
||||
if (!isset($database->proxy_timeout) || $database->proxy_timeout === null) {
|
||||
throw new \Exception('Proxy timeout is required.');
|
||||
}
|
||||
if ($database->proxy_timeout <= 0) {
|
||||
throw new \Exception('Proxy timeout must be greater than 0.');
|
||||
}
|
||||
if ($database->proxy_timeout > 86400) {
|
||||
throw new \Exception('Proxy timeout must not exceed 86400 seconds (24 hours).');
|
||||
}
|
||||
|
||||
$databaseType = $database->database_type;
|
||||
$network = data_get($database, 'destination.network');
|
||||
$server = data_get($database, 'destination.server');
|
||||
|
|
@ -56,7 +67,7 @@ class StartDatabaseProxy
|
|||
$configuration_dir = '/var/lib/docker/volumes/coolify_dev_coolify_data/_data/databases/'.$database->uuid.'/proxy';
|
||||
}
|
||||
$proxyTimeout = $database->proxy_timeout ?? 1800; // Default to 30 minutes if not set
|
||||
$timeoutDirective = $proxyTimeout > 0 ? "proxy_timeout {$proxyTimeout}s;" : "";
|
||||
$timeoutDirective = "proxy_timeout {$proxyTimeout}s;";
|
||||
$nginxconf = <<<EOF
|
||||
user nginx;
|
||||
worker_processes auto;
|
||||
|
|
|
|||
Loading…
Reference in a new issue