Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

feat: require health check command for 'cmd' type with backend validation and frontend update

Aditya Tripathi1ef635170192
diff --git a/app/Livewire/Project/Shared/HealthChecks.php b/app/Livewire/Project/Shared/HealthChecks.php
index ec4f494f81..ac25f6a771 100644
--- a/app/Livewire/Project/Shared/HealthChecks.php
+++ b/app/Livewire/Project/Shared/HealthChecks.php
@@ -19,7 +19,7 @@ class HealthChecks extends Component
#[Validate(['string', 'in:http,cmd'])]
public string $healthCheckType = 'http';
- #[Validate(['nullable', 'string'])]
+ #[Validate(['nullable', 'required_if:healthCheckType,cmd', 'string'])]
public ?string $healthCheckCommand = null;
#[Validate(['string'])]
@@ -128,6 +128,7 @@ class HealthChecks extends Component
public function instantSave()
{
$this->authorize('update', $this->resource);
+ $this->validate();
// Sync component properties to model
$this->resource->health_check_enabled = $this->healthCheckEnabled;
diff --git a/resources/views/livewire/project/shared/health-checks.blade.php b/resources/views/livewire/project/shared/health-checks.blade.php
index a0027c62c5..c181f3f1a1 100644
--- a/resources/views/livewire/project/shared/health-checks.blade.php
+++ b/resources/views/livewire/project/shared/health-checks.blade.php
@@ -57,7 +57,7 @@
label="Command"
placeholder="Example: pg_isready -U postgres
Example: redis-cli ping
Example: curl -f http://localhost:8080/health"
helper="The command to run inside the container. It should exit with code 0 on success and non-zero on failure."
- required />
+ :required="$healthCheckType === 'cmd'" />
</div>
@endif