diff --git a/config/constants.php b/config/constants.php index 83b8b22301..6bc8885be2 100644 --- a/config/constants.php +++ b/config/constants.php @@ -1,5 +1,8 @@ [ 'version' => env('COOLIFY_VERSION') ?: '4.4', @@ -79,7 +82,7 @@ return [ 'mux_orphan_reap_enabled' => env('SSH_MUX_ORPHAN_REAP_ENABLED', false), // false = dry-run, only log orphans 'connection_timeout' => 10, 'server_interval' => 20, - 'command_timeout' => env('SSH_COMMAND_TIMEOUT', 3600), + 'command_timeout' => $sshCommandTimeout > 0 ? $sshCommandTimeout : 3600, 'max_retries' => env('SSH_MAX_RETRIES', 3), 'retry_base_delay' => env('SSH_RETRY_BASE_DELAY', 2), // seconds 'retry_max_delay' => env('SSH_RETRY_MAX_DELAY', 30), // seconds diff --git a/tests/Feature/SshCommandTimeoutConfigTest.php b/tests/Feature/SshCommandTimeoutConfigTest.php new file mode 100644 index 0000000000..1bbeb188f0 --- /dev/null +++ b/tests/Feature/SshCommandTimeoutConfigTest.php @@ -0,0 +1,47 @@ +toBe(3600); +})->with([ + 'not set' => null, + 'zero' => '0', + 'negative' => '-5', + 'not a number' => 'never', +]); + +it('keeps a positive SSH command timeout', function () { + expect(sshCommandTimeoutFromEnv('7200'))->toBe(7200); +});