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.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
Fix styling
andrasbacsai47051127afa4
diff --git a/app/Livewire/Project/Application/General.php b/app/Livewire/Project/Application/General.phpindex fde85755d1..60cdee48e6 100644--- a/app/Livewire/Project/Application/General.php+++ b/app/Livewire/Project/Application/General.php@@ -153,7 +153,7 @@ class General extends Component$this->is_container_label_escape_enabled = $this->application->settings->is_container_label_escape_enabled;$this->customLabels = $this->application->parseContainerLabels();if (! $this->customLabels && $this->application->destination->server->proxyType() !== 'NONE') {- $this->customLabels = str(implode("|coolify|", generateLabelsApplication($this->application)))->replace("|coolify|", "\n");+ $this->customLabels = str(implode('|coolify|', generateLabelsApplication($this->application)))->replace('|coolify|', "\n");$this->application->custom_labels = base64_encode($this->customLabels);$this->application->save();}@@ -300,7 +300,7 @@ class General extends Componentpublic function resetDefaultLabels(){- $this->customLabels = str(implode("|coolify|", generateLabelsApplication($this->application)))->replace("|coolify|", "\n");+ $this->customLabels = str(implode('|coolify|', generateLabelsApplication($this->application)))->replace('|coolify|', "\n");$this->ports_exposes = $this->application->ports_exposes;$this->is_container_label_escape_enabled = $this->application->settings->is_container_label_escape_enabled;$this->application->custom_labels = base64_encode($this->customLabels);@@ -326,12 +326,14 @@ class General extends Component$this->application->fqdn = $domains->implode(',');}}+public function set_redirect(){try {$has_www = collect($this->application->fqdns)->filter(fn ($fqdn) => str($fqdn)->contains('www.'))->count();if ($has_www === 0 && $this->application->redirect === 'www') {$this->dispatch('error', 'You want to redirect to www, but you do not have a www domain set.<br><br>Please add www to your domain list and as an A DNS record (if applicable).');+return;}$this->application->save();@@ -358,7 +360,7 @@ class General extends Component$this->application->save();if (! $this->customLabels && $this->application->destination->server->proxyType() !== 'NONE') {- $this->customLabels = str(implode("|coolify|", generateLabelsApplication($this->application)))->replace("|coolify|", "\n");+ $this->customLabels = str(implode('|coolify|', generateLabelsApplication($this->application)))->replace('|coolify|', "\n");$this->application->custom_labels = base64_encode($this->customLabels);$this->application->save();}diff --git a/app/Livewire/Project/Shared/ResourceOperations.php b/app/Livewire/Project/Shared/ResourceOperations.phpindex 9b8002e5df..586a125ae7 100644--- a/app/Livewire/Project/Shared/ResourceOperations.php+++ b/app/Livewire/Project/Shared/ResourceOperations.php@@ -51,7 +51,7 @@ class ResourceOperations extends Component]);$new_resource->save();if ($new_resource->destination->server->proxyType() !== 'NONE') {- $customLabels = str(implode("|coolify|", generateLabelsApplication($new_resource)))->replace("|coolify|", "\n");+ $customLabels = str(implode('|coolify|', generateLabelsApplication($new_resource)))->replace('|coolify|', "\n");$new_resource->custom_labels = base64_encode($customLabels);$new_resource->save();}diff --git a/app/Models/Application.php b/app/Models/Application.phpindex dae1a520bd..af2d463c4a 100644--- a/app/Models/Application.php+++ b/app/Models/Application.php@@ -632,7 +632,7 @@ class Application extends BaseModelpublic function isConfigurationChanged(bool $save = false){- $newConfigHash = $this->fqdn . $this->git_repository . $this->git_branch . $this->git_commit_sha . $this->build_pack . $this->static_image . $this->install_command . $this->build_command . $this->start_command . $this->ports_exposes . $this->ports_mappings . $this->base_directory . $this->publish_directory . $this->dockerfile . $this->dockerfile_location . $this->custom_labels . $this->custom_docker_run_options . $this->dockerfile_target_build . $this->redirect;+ $newConfigHash = $this->fqdn.$this->git_repository.$this->git_branch.$this->git_commit_sha.$this->build_pack.$this->static_image.$this->install_command.$this->build_command.$this->start_command.$this->ports_exposes.$this->ports_mappings.$this->base_directory.$this->publish_directory.$this->dockerfile.$this->dockerfile_location.$this->custom_labels.$this->custom_docker_run_options.$this->dockerfile_target_build.$this->redirect;if ($this->pull_request_id === 0 || $this->pull_request_id === null) {$newConfigHash .= json_encode($this->environment_variables()->get('value')->sort());} else {@@ -1032,7 +1032,7 @@ class Application extends BaseModel$customLabels = base64_decode($this->custom_labels);if (mb_detect_encoding($customLabels, 'ASCII', true) === false) {ray('custom_labels contains non-ascii characters');- $customLabels = str(implode("|coolify|", generateLabelsApplication($this, $preview)))->replace("|coolify|", "\n");+ $customLabels = str(implode('|coolify|', generateLabelsApplication($this, $preview)))->replace('|coolify|', "\n");}$this->custom_labels = base64_encode($customLabels);$this->save();diff --git a/bootstrap/helpers/docker.php b/bootstrap/helpers/docker.phpindex 6ccf841659..91e553cf6a 100644--- a/bootstrap/helpers/docker.php+++ b/bootstrap/helpers/docker.php@@ -278,7 +278,7 @@ function fqdnLabelsForCaddy(string $network, string $uuid, Collection $domains,if ($is_gzip_enabled) {$labels->push("caddy_{$loop}.encode=zstd gzip");}- if ($redirect_direction === 'www' && !str($host)->startsWith('www.')) {+ if ($redirect_direction === 'www' && ! str($host)->startsWith('www.')) {$labels->push("caddy_{$loop}.redir={$schema}://www.{$host}{uri}");}if ($redirect_direction === 'non-www' && str($host)->startsWith('www.')) {@@ -303,7 +303,6 @@ function fqdnLabelsForTraefik(string $uuid, Collection $domains, bool $is_force_$redirect = false;$redirect_middleware = null;-if ($serviceLabels) {$basic_auth = $serviceLabels->contains(function ($value) {return str_contains($value, 'basicauth');@@ -362,12 +361,12 @@ function fqdnLabelsForTraefik(string $uuid, Collection $domains, bool $is_force_$redirect_to_non_www = ["traefik.http.middlewares.{$to_non_www_name}.redirectregex.regex=^(http|https)://www\.(.+)","traefik.http.middlewares.{$to_non_www_name}.redirectregex.replacement=\${1}://\${2}",- "traefik.http.middlewares.{$to_non_www_name}.redirectregex.permanent=false"+ "traefik.http.middlewares.{$to_non_www_name}.redirectregex.permanent=false",];$redirect_to_www = ["traefik.http.middlewares.{$to_www_name}.redirectregex.regex=^(http|https)://(?:www\.)?(.+)","traefik.http.middlewares.{$to_www_name}.redirectregex.replacement=\${1}://www.\${2}",- "traefik.http.middlewares.{$to_www_name}.redirectregex.permanent=false"+ "traefik.http.middlewares.{$to_www_name}.redirectregex.permanent=false",];if ($schema === 'https') {// Set labels for https@@ -399,7 +398,7 @@ function fqdnLabelsForTraefik(string $uuid, Collection $domains, bool $is_force_$labels = $labels->merge($redirect_to_non_www);$middlewares->push($to_non_www_name);}- if ($redirect_direction === 'www' && !str($host)->startsWith('www.')) {+ if ($redirect_direction === 'www' && ! str($host)->startsWith('www.')) {$labels = $labels->merge($redirect_to_www);$middlewares->push($to_www_name);}@@ -425,7 +424,7 @@ function fqdnLabelsForTraefik(string $uuid, Collection $domains, bool $is_force_$labels = $labels->merge($redirect_to_non_www);$middlewares->push($to_non_www_name);}- if ($redirect_direction === 'www' && !str($host)->startsWith('www.')) {+ if ($redirect_direction === 'www' && ! str($host)->startsWith('www.')) {$labels = $labels->merge($redirect_to_www);$middlewares->push($to_www_name);}@@ -477,7 +476,7 @@ function fqdnLabelsForTraefik(string $uuid, Collection $domains, bool $is_force_$labels = $labels->merge($redirect_to_non_www);$middlewares->push($to_non_www_name);}- if ($redirect_direction === 'www' && !str($host)->startsWith('www.')) {+ if ($redirect_direction === 'www' && ! str($host)->startsWith('www.')) {$labels = $labels->merge($redirect_to_www);$middlewares->push($to_www_name);}@@ -503,7 +502,7 @@ function fqdnLabelsForTraefik(string $uuid, Collection $domains, bool $is_force_$labels = $labels->merge($redirect_to_non_www);$middlewares->push($to_non_www_name);}- if ($redirect_direction === 'www' && !str($host)->startsWith('www.')) {+ if ($redirect_direction === 'www' && ! str($host)->startsWith('www.')) {$labels = $labels->merge($redirect_to_www);$middlewares->push($to_www_name);}