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.

Merge remote-tracking branch 'origin/next' into feat/noindex-domains

Andras Bacsai54adea26c2aa
diff --cc app/Http/Controllers/Api/ApplicationsController.php
index 318101661d,5932077355..95ebeeb077
--- a/app/Http/Controllers/Api/ApplicationsController.php
+++ b/app/Http/Controllers/Api/ApplicationsController.php
@@@ -986,7 -1120,7 +1125,7 @@@ class ApplicationsController extends Co
if ($return instanceof JsonResponse) {
return $return;
}
- $allowedFields = ['project_uuid', 'environment_name', 'environment_uuid', 'server_uuid', 'destination_uuid', 'type', 'name', 'description', 'is_static', 'is_spa', 'is_auto_deploy_enabled', 'is_force_https_enabled', 'is_preview_deployments_enabled', 'domains', 'noindex_domains', 'git_repository', 'git_branch', 'git_commit_sha', 'private_key_uuid', 'docker_registry_image_name', 'docker_registry_image_tag', 'build_pack', 'install_command', 'build_command', 'start_command', 'ports_exposes', 'ports_mappings', 'custom_network_aliases', 'base_directory', 'publish_directory', 'health_check_enabled', 'health_check_type', 'health_check_command', 'health_check_path', 'health_check_port', 'health_check_host', 'health_check_method', 'health_check_return_code', 'health_check_scheme', 'health_check_response_text', 'health_check_interval', 'health_check_timeout', 'health_check_retries', 'health_check_start_period', 'limits_memory', 'limits_memory_swap', 'limits_memory_swappiness', 'limits_memory_reservation', 'limits_cpus', 'limits_cpuset', 'limits_cpu_shares', 'custom_labels', 'custom_docker_run_options', 'post_deployment_command', 'post_deployment_command_container', 'pre_deployment_command', 'pre_deployment_command_container', 'manual_webhook_secret_github', 'manual_webhook_secret_gitlab', 'manual_webhook_secret_bitbucket', 'manual_webhook_secret_gitea', 'redirect', 'github_app_uuid', 'instant_deploy', 'dockerfile', 'dockerfile_location', 'docker_compose_location', 'docker_compose_raw', 'docker_compose_custom_start_command', 'docker_compose_custom_build_command', 'docker_compose_domains', 'watch_paths', 'use_build_server', 'static_image', 'custom_nginx_configuration', 'is_http_basic_auth_enabled', 'http_basic_auth_username', 'http_basic_auth_password', 'connect_to_docker_network', 'force_domain_override', 'autogenerate_domain', 'is_container_label_escape_enabled', 'tags', 'is_preserve_repository_enabled'];
- $allowedFields = ['project_uuid', 'environment_name', 'environment_uuid', 'server_uuid', 'destination_uuid', 'type', 'name', 'description', 'is_static', 'is_spa', 'is_auto_deploy_enabled', 'is_force_https_enabled', 'is_preview_deployments_enabled', 'domains', 'git_repository', 'git_branch', 'git_commit_sha', 'private_key_uuid', 'docker_registry_image_name', 'docker_registry_image_tag', 'build_pack', 'install_command', 'build_command', 'start_command', 'ports_exposes', 'ports_mappings', 'custom_network_aliases', 'base_directory', 'publish_directory', 'health_check_enabled', 'health_check_type', 'health_check_command', 'health_check_path', 'health_check_port', 'health_check_host', 'health_check_method', 'health_check_return_code', 'health_check_scheme', 'health_check_response_text', 'health_check_interval', 'health_check_timeout', 'health_check_retries', 'health_check_start_period', 'limits_memory', 'limits_memory_swap', 'limits_memory_swappiness', 'limits_memory_reservation', 'limits_cpus', 'limits_cpuset', 'limits_cpu_shares', 'custom_labels', 'custom_docker_run_options', 'post_deployment_command', 'post_deployment_command_container', 'pre_deployment_command', 'pre_deployment_command_container', 'manual_webhook_secret_github', 'manual_webhook_secret_gitlab', 'manual_webhook_secret_bitbucket', 'manual_webhook_secret_gitea', 'redirect', 'github_app_uuid', 'instant_deploy', 'dockerfile', 'dockerfile_location', 'docker_compose_location', 'docker_compose_raw', 'docker_compose_custom_start_command', 'docker_compose_custom_build_command', 'docker_compose_domains', 'watch_paths', 'use_build_server', 'use_build_secrets', 'static_image', 'custom_nginx_configuration', 'is_http_basic_auth_enabled', 'http_basic_auth_username', 'http_basic_auth_password', 'connect_to_docker_network', 'force_domain_override', 'autogenerate_domain', 'is_container_label_escape_enabled', 'tags', 'is_preserve_repository_enabled', ...self::APPLICATION_SETTING_FIELDS];
++ $allowedFields = ['project_uuid', 'environment_name', 'environment_uuid', 'server_uuid', 'destination_uuid', 'type', 'name', 'description', 'is_static', 'is_spa', 'is_auto_deploy_enabled', 'is_force_https_enabled', 'is_preview_deployments_enabled', 'domains', 'noindex_domains', 'git_repository', 'git_branch', 'git_commit_sha', 'private_key_uuid', 'docker_registry_image_name', 'docker_registry_image_tag', 'build_pack', 'install_command', 'build_command', 'start_command', 'ports_exposes', 'ports_mappings', 'custom_network_aliases', 'base_directory', 'publish_directory', 'health_check_enabled', 'health_check_type', 'health_check_command', 'health_check_path', 'health_check_port', 'health_check_host', 'health_check_method', 'health_check_return_code', 'health_check_scheme', 'health_check_response_text', 'health_check_interval', 'health_check_timeout', 'health_check_retries', 'health_check_start_period', 'limits_memory', 'limits_memory_swap', 'limits_memory_swappiness', 'limits_memory_reservation', 'limits_cpus', 'limits_cpuset', 'limits_cpu_shares', 'custom_labels', 'custom_docker_run_options', 'post_deployment_command', 'post_deployment_command_container', 'pre_deployment_command', 'pre_deployment_command_container', 'manual_webhook_secret_github', 'manual_webhook_secret_gitlab', 'manual_webhook_secret_bitbucket', 'manual_webhook_secret_gitea', 'redirect', 'github_app_uuid', 'instant_deploy', 'dockerfile', 'dockerfile_location', 'docker_compose_location', 'docker_compose_raw', 'docker_compose_custom_start_command', 'docker_compose_custom_build_command', 'docker_compose_domains', 'watch_paths', 'use_build_server', 'use_build_secrets', 'static_image', 'custom_nginx_configuration', 'is_http_basic_auth_enabled', 'http_basic_auth_username', 'http_basic_auth_password', 'connect_to_docker_network', 'force_domain_override', 'autogenerate_domain', 'is_container_label_escape_enabled', 'tags', 'is_preserve_repository_enabled', ...self::APPLICATION_SETTING_FIELDS];
$validator = customApiValidator($request->all(), [
'name' => 'string|max:255',
@@@ -2501,7 -2686,7 +2692,7 @@@
$this->authorize('update', $application);
$server = $application->destination->server;
- $allowedFields = ['name', 'description', 'is_static', 'is_spa', 'is_auto_deploy_enabled', 'is_force_https_enabled', 'is_preview_deployments_enabled', 'domains', 'noindex_domains', 'git_repository', 'git_branch', 'git_commit_sha', 'docker_registry_image_name', 'docker_registry_image_tag', 'build_pack', 'static_image', 'install_command', 'build_command', 'start_command', 'ports_exposes', 'ports_mappings', 'custom_network_aliases', 'base_directory', 'publish_directory', 'health_check_enabled', 'health_check_type', 'health_check_command', 'health_check_path', 'health_check_port', 'health_check_host', 'health_check_method', 'health_check_return_code', 'health_check_scheme', 'health_check_response_text', 'health_check_interval', 'health_check_timeout', 'health_check_retries', 'health_check_start_period', 'limits_memory', 'limits_memory_swap', 'limits_memory_swappiness', 'limits_memory_reservation', 'limits_cpus', 'limits_cpuset', 'limits_cpu_shares', 'custom_labels', 'custom_docker_run_options', 'post_deployment_command', 'post_deployment_command_container', 'pre_deployment_command', 'pre_deployment_command_container', 'watch_paths', 'manual_webhook_secret_github', 'manual_webhook_secret_gitlab', 'manual_webhook_secret_bitbucket', 'manual_webhook_secret_gitea', 'dockerfile_location', 'dockerfile_target_build', 'docker_compose_location', 'docker_compose_custom_start_command', 'docker_compose_custom_build_command', 'docker_compose_domains', 'redirect', 'instant_deploy', 'use_build_server', 'custom_nginx_configuration', 'is_http_basic_auth_enabled', 'http_basic_auth_username', 'http_basic_auth_password', 'connect_to_docker_network', 'force_domain_override', 'is_container_label_escape_enabled', 'is_preserve_repository_enabled', 'include_source_commit_in_build'];
- $allowedFields = ['name', 'description', 'is_static', 'is_spa', 'is_auto_deploy_enabled', 'is_force_https_enabled', 'is_preview_deployments_enabled', 'domains', 'git_repository', 'git_branch', 'git_commit_sha', 'docker_registry_image_name', 'docker_registry_image_tag', 'build_pack', 'static_image', 'install_command', 'build_command', 'start_command', 'ports_exposes', 'ports_mappings', 'custom_network_aliases', 'base_directory', 'publish_directory', 'health_check_enabled', 'health_check_type', 'health_check_command', 'health_check_path', 'health_check_port', 'health_check_host', 'health_check_method', 'health_check_return_code', 'health_check_scheme', 'health_check_response_text', 'health_check_interval', 'health_check_timeout', 'health_check_retries', 'health_check_start_period', 'limits_memory', 'limits_memory_swap', 'limits_memory_swappiness', 'limits_memory_reservation', 'limits_cpus', 'limits_cpuset', 'limits_cpu_shares', 'custom_labels', 'custom_docker_run_options', 'post_deployment_command', 'post_deployment_command_container', 'pre_deployment_command', 'pre_deployment_command_container', 'watch_paths', 'manual_webhook_secret_github', 'manual_webhook_secret_gitlab', 'manual_webhook_secret_bitbucket', 'manual_webhook_secret_gitea', 'dockerfile_location', 'dockerfile_target_build', 'docker_compose_location', 'docker_compose_custom_start_command', 'docker_compose_custom_build_command', 'docker_compose_domains', 'redirect', 'instant_deploy', 'use_build_server', 'use_build_secrets', 'custom_nginx_configuration', 'is_http_basic_auth_enabled', 'http_basic_auth_username', 'http_basic_auth_password', 'connect_to_docker_network', 'force_domain_override', 'is_container_label_escape_enabled', 'is_preserve_repository_enabled', ...self::APPLICATION_SETTING_FIELDS];
++ $allowedFields = ['name', 'description', 'is_static', 'is_spa', 'is_auto_deploy_enabled', 'is_force_https_enabled', 'is_preview_deployments_enabled', 'domains', 'noindex_domains', 'git_repository', 'git_branch', 'git_commit_sha', 'docker_registry_image_name', 'docker_registry_image_tag', 'build_pack', 'static_image', 'install_command', 'build_command', 'start_command', 'ports_exposes', 'ports_mappings', 'custom_network_aliases', 'base_directory', 'publish_directory', 'health_check_enabled', 'health_check_type', 'health_check_command', 'health_check_path', 'health_check_port', 'health_check_host', 'health_check_method', 'health_check_return_code', 'health_check_scheme', 'health_check_response_text', 'health_check_interval', 'health_check_timeout', 'health_check_retries', 'health_check_start_period', 'limits_memory', 'limits_memory_swap', 'limits_memory_swappiness', 'limits_memory_reservation', 'limits_cpus', 'limits_cpuset', 'limits_cpu_shares', 'custom_labels', 'custom_docker_run_options', 'post_deployment_command', 'post_deployment_command_container', 'pre_deployment_command', 'pre_deployment_command_container', 'watch_paths', 'manual_webhook_secret_github', 'manual_webhook_secret_gitlab', 'manual_webhook_secret_bitbucket', 'manual_webhook_secret_gitea', 'dockerfile_location', 'dockerfile_target_build', 'docker_compose_location', 'docker_compose_custom_start_command', 'docker_compose_custom_build_command', 'docker_compose_domains', 'redirect', 'instant_deploy', 'use_build_server', 'use_build_secrets', 'custom_nginx_configuration', 'is_http_basic_auth_enabled', 'http_basic_auth_username', 'http_basic_auth_password', 'connect_to_docker_network', 'force_domain_override', 'is_container_label_escape_enabled', 'is_preserve_repository_enabled', ...self::APPLICATION_SETTING_FIELDS];
$validationRules = [
'name' => 'string|max:255',
diff --cc bootstrap/helpers/api.php
index fd401e1bd9,e314ead82b..7fdb19ca62
--- a/bootstrap/helpers/api.php
+++ b/bootstrap/helpers/api.php
@@@ -117,10 -117,22 +117,24 @@@ function sharedDataApplications(
'is_auto_deploy_enabled' => 'boolean',
'is_force_https_enabled' => 'boolean',
'is_preview_deployments_enabled' => 'boolean',
+ 'use_build_secrets' => 'boolean',
+ 'is_git_submodules_enabled' => 'boolean',
+ 'is_git_lfs_enabled' => 'boolean',
+ 'is_git_shallow_clone_enabled' => 'boolean',
+ 'disable_build_cache' => 'boolean',
+ 'inject_build_args_to_dockerfile' => 'boolean',
+ 'include_source_commit_in_build' => 'boolean',
+ 'is_env_sorting_enabled' => 'boolean',
+ 'is_pr_deployments_public_enabled' => 'boolean',
+ 'is_gzip_enabled' => 'boolean',
+ 'is_stripprefix_enabled' => 'boolean',
+ 'is_raw_compose_deployment_enabled' => 'boolean',
+ 'stop_grace_period' => 'nullable|integer|min:'.MIN_STOP_GRACE_PERIOD_SECONDS.'|max:'.MAX_STOP_GRACE_PERIOD_SECONDS,
+ 'docker_images_to_keep' => 'integer|min:0|max:100',
'static_image' => Rule::enum(StaticImageTypes::class),
'domains' => ValidationPatterns::applicationDomainRules(),
+ 'noindex_domains' => 'array|nullable',
+ 'noindex_domains.*' => 'string',
'redirect' => Rule::enum(RedirectTypes::class),
'git_commit_sha' => ['string', 'regex:/^[a-zA-Z0-9][a-zA-Z0-9._\-\/]*$/'],
'docker_registry_image_name' => ValidationPatterns::dockerImageNameRules(),
diff --cc openapi.json
index 4f34d3f654,4a3a932ca5..9238907376
--- a/openapi.json
+++ b/openapi.json
@@@ -137,6 -137,6 +137,13 @@@
"type": "string",
"description": "The application URLs in a comma-separated list."
},
++ "noindex_domains": {
++ "type": "array",
++ "items": {
++ "type": "string"
++ },
++ "description": "The subset of the application domains served with an X-Robots-Tag: noindex, nofollow response header, keeping them out of search engines. Entries that are not among the application domains are ignored."
++ },
"git_commit_sha": {
"type": "string",
"description": "The git commit SHA."
@@@ -598,6 -660,6 +667,13 @@@
"type": "string",
"description": "The application URLs in a comma-separated list."
},
++ "noindex_domains": {
++ "type": "array",
++ "items": {
++ "type": "string"
++ },
++ "description": "The subset of the application domains served with an X-Robots-Tag: noindex, nofollow response header, keeping them out of search engines. Entries that are not among the application domains are ignored."
++ },
"git_commit_sha": {
"type": "string",
"description": "The git commit SHA."
@@@ -1059,6 -1183,6 +1197,13 @@@
"type": "string",
"description": "The application URLs in a comma-separated list."
},
++ "noindex_domains": {
++ "type": "array",
++ "items": {
++ "type": "string"
++ },
++ "description": "The subset of the application domains served with an X-Robots-Tag: noindex, nofollow response header, keeping them out of search engines. Entries that are not among the application domains are ignored."
++ },
"git_commit_sha": {
"type": "string",
"description": "The git commit SHA."
@@@ -1505,6 -1691,6 +1712,13 @@@
"type": "string",
"description": "The application URLs in a comma-separated list."
},
++ "noindex_domains": {
++ "type": "array",
++ "items": {
++ "type": "string"
++ },
++ "description": "The subset of the application domains served with an X-Robots-Tag: noindex, nofollow response header, keeping them out of search engines. Entries that are not among the application domains are ignored."
++ },
"docker_registry_image_name": {
"type": "string",
"description": "The docker registry image name."
@@@ -1863,6 -2111,6 +2139,13 @@@
"type": "string",
"description": "The application URLs in a comma-separated list."
},
++ "noindex_domains": {
++ "type": "array",
++ "items": {
++ "type": "string"
++ },
++ "description": "The subset of the application domains served with an X-Robots-Tag: noindex, nofollow response header, keeping them out of search engines. Entries that are not among the application domains are ignored."
++ },
"ports_mappings": {
"type": "string",
"description": "The ports mappings."
@@@ -2360,6 -2670,6 +2705,13 @@@
"type": "string",
"description": "The application URLs in a comma-separated list."
},
++ "noindex_domains": {
++ "type": "array",
++ "items": {
++ "type": "string"
++ },
++ "description": "The subset of the application domains served with an X-Robots-Tag: noindex, nofollow response header, keeping them out of search engines. Entries that are not among the application domains are ignored."
++ },
"git_commit_sha": {
"type": "string",
"description": "The git commit SHA."
@@@ -12212,6 -12579,6 +12621,16 @@@
"null"
]
},
++ "noindex_domains": {
++ "description": "The subset of the service application domains served with an X-Robots-Tag: noindex, nofollow response header, keeping them out of search engines. Entries that are not among the domains are ignored.",
++ "type": [
++ "array",
++ "null"
++ ],
++ "items": {
++ "type": "string"
++ }
++ },
"human_name": {
"type": [
"string",
@@@ -14783,6 -15150,6 +15202,14 @@@
"nullable": true,
"description": "The application domains."
},
++ "noindex_domains": {
++ "type": "array",
++ "items": {
++ "type": "string"
++ },
++ "nullable": true,
++ "description": "The subset of the application domains served with an X-Robots-Tag: noindex, nofollow response header."
++ },
"config_hash": {
"type": "string",
"description": "Configuration hash."
diff --cc openapi.yaml
index 55751abd5d,6dfe91e0a9..0151333052
--- a/openapi.yaml
+++ b/openapi.yaml
@@@ -97,6 -97,6 +97,10 @@@ paths
domains:
type: string
description: 'The application URLs in a comma-separated list.'
++ noindex_domains:
++ type: array
++ items: { type: string }
++ description: 'The subset of the application domains served with an X-Robots-Tag: noindex, nofollow response header, keeping them out of search engines. Entries that are not among the application domains are ignored.'
git_commit_sha:
type: string
description: 'The git commit SHA.'
@@@ -391,6 -439,6 +443,10 @@@
domains:
type: string
description: 'The application URLs in a comma-separated list.'
++ noindex_domains:
++ type: array
++ items: { type: string }
++ description: 'The subset of the application domains served with an X-Robots-Tag: noindex, nofollow response header, keeping them out of search engines. Entries that are not among the application domains are ignored.'
git_commit_sha:
type: string
description: 'The git commit SHA.'
@@@ -685,6 -781,6 +789,10 @@@
domains:
type: string
description: 'The application URLs in a comma-separated list.'
++ noindex_domains:
++ type: array
++ items: { type: string }
++ description: 'The subset of the application domains served with an X-Robots-Tag: noindex, nofollow response header, keeping them out of search engines. Entries that are not among the application domains are ignored.'
git_commit_sha:
type: string
description: 'The git commit SHA.'
@@@ -970,6 -1114,6 +1126,10 @@@
domains:
type: string
description: 'The application URLs in a comma-separated list.'
++ noindex_domains:
++ type: array
++ items: { type: string }
++ description: 'The subset of the application domains served with an X-Robots-Tag: noindex, nofollow response header, keeping them out of search engines. Entries that are not among the application domains are ignored.'
docker_registry_image_name:
type: string
description: 'The docker registry image name.'
@@@ -1200,6 -1392,6 +1408,10 @@@
domains:
type: string
description: 'The application URLs in a comma-separated list.'
++ noindex_domains:
++ type: array
++ items: { type: string }
++ description: 'The subset of the application domains served with an X-Robots-Tag: noindex, nofollow response header, keeping them out of search engines. Entries that are not among the application domains are ignored.'
ports_mappings:
type: string
description: 'The ports mappings.'
@@@ -1521,6 -1761,6 +1781,10 @@@
domains:
type: string
description: 'The application URLs in a comma-separated list.'
++ noindex_domains:
++ type: array
++ items: { type: string }
++ description: 'The subset of the application domains served with an X-Robots-Tag: noindex, nofollow response header, keeping them out of search engines. Entries that are not among the application domains are ignored.'
git_commit_sha:
type: string
description: 'The git commit SHA.'
@@@ -7805,6 -8089,6 +8113,10 @@@
url:
description: 'Comma-separated list of URLs (e.g. "http://app.example.com:8080,https://app2.example.com"). Stored as fqdn.'
type: [string, 'null']
++ noindex_domains:
++ description: 'The subset of the service application domains served with an X-Robots-Tag: noindex, nofollow response header, keeping them out of search engines. Entries that are not among the domains are ignored.'
++ type: [array, 'null']
++ items: { type: string }
human_name:
type: [string, 'null']
description:
@@@ -9399,6 -9683,6 +9711,12 @@@ components
type: string
nullable: true
description: 'The application domains.'
++ noindex_domains:
++ type: array
++ items:
++ type: string
++ nullable: true
++ description: 'The subset of the application domains served with an X-Robots-Tag: noindex, nofollow response header.'
config_hash:
type: string
description: 'Configuration hash.'
diff --cc tests/Feature/ApplicationNoindexDomainsTest.php
index 1369fab0b9,0000000000..9077bc9424
mode 100644,000000..100644
--- a/tests/Feature/ApplicationNoindexDomainsTest.php
+++ b/tests/Feature/ApplicationNoindexDomainsTest.php
@@@ -1,98 -1,0 +1,119 @@@
+<?php
+
+use App\Livewire\Project\Application\General;
+use App\Models\Application;
+use App\Models\Environment;
++use App\Models\InstanceSettings;
++use App\Models\PrivateKey;
+use App\Models\Project;
++use App\Models\Server;
++use App\Models\StandaloneDocker;
+use App\Models\Team;
+use App\Models\User;
+use Illuminate\Foundation\Testing\RefreshDatabase;
+use Livewire\Livewire;
+
+uses(RefreshDatabase::class);
+
+beforeEach(function () {
+ $this->team = Team::factory()->create();
+ $this->user = User::factory()->create();
+ $this->team->members()->attach($this->user->id, ['role' => 'owner']);
+
+ $this->actingAs($this->user);
+ session(['currentTeam' => $this->team]);
+
+ $this->project = Project::factory()->create(['team_id' => $this->team->id]);
+ $this->environment = Environment::factory()->create(['project_id' => $this->project->id]);
+});
+
+describe('Application noindex domains', function () {
+ test('a flag is kept only for a domain the application actually has', function () {
+ $application = Application::factory()->create([
+ 'environment_id' => $this->environment->id,
+ 'fqdn' => 'https://prod.example.com,https://staging.example.com',
+ ]);
+
+ $application->setNoindexDomains([
+ 'https://staging.example.com',
+ 'https://never-configured.example.com',
+ ]);
+ $application->save();
+
+ expect($application->refresh()->noindexDomains()->all())
+ ->toBe(['https://staging.example.com']);
+ });
+
+ test('removing a domain prunes its flag', function () {
+ $application = Application::factory()->create([
+ 'environment_id' => $this->environment->id,
+ 'fqdn' => 'https://prod.example.com,https://staging.example.com',
+ 'noindex_domains' => ['https://staging.example.com'],
+ ]);
+
+ // The staging domain goes away; its flag must not survive to be silently
+ // resurrected if the same domain is added back later.
+ $application->fqdn = 'https://prod.example.com';
+ $application->save();
+
+ expect($application->refresh()->noindexDomains()->all())->toBeEmpty();
+ });
+
+ test('flags survive a save that does not touch the domains', function () {
+ $application = Application::factory()->create([
+ 'environment_id' => $this->environment->id,
+ 'fqdn' => 'https://prod.example.com,https://staging.example.com',
+ 'noindex_domains' => ['https://staging.example.com'],
+ ]);
+
+ $application->name = 'renamed';
+ $application->save();
+
+ expect($application->refresh()->noindexDomains()->all())
+ ->toBe(['https://staging.example.com']);
+ });
+
+ test('isDomainNoindexed ignores casing', function () {
+ $application = Application::factory()->create([
+ 'environment_id' => $this->environment->id,
+ 'fqdn' => 'https://staging.example.com',
+ 'noindex_domains' => ['https://staging.example.com'],
+ ]);
+
+ expect($application->isDomainNoindexed('https://Staging.Example.COM'))->toBeTrue();
+ expect($application->isDomainNoindexed('https://prod.example.com'))->toBeFalse();
+ });
+
+ test('the Livewire toggle persists the flag', function () {
++ InstanceSettings::unguarded(function () {
++ InstanceSettings::updateOrCreate(['id' => 0], []);
++ });
++ $privateKey = PrivateKey::factory()->create(['team_id' => $this->team->id]);
++ $server = Server::factory()->create([
++ 'team_id' => $this->team->id,
++ 'private_key_id' => $privateKey->id,
++ ]);
++ $destination = StandaloneDocker::where('server_id', $server->id)->first()
++ ?? StandaloneDocker::factory()->create(['server_id' => $server->id]);
++
+ $application = Application::factory()->create([
+ 'environment_id' => $this->environment->id,
++ 'destination_id' => $destination->id,
++ 'destination_type' => StandaloneDocker::class,
+ 'fqdn' => 'https://prod.example.com,https://staging.example.com',
++ 'static_image' => 'nginx:alpine',
++ 'base_directory' => '/',
++ 'is_http_basic_auth_enabled' => false,
++ 'redirect' => 'no',
+ ]);
+
+ Livewire::test(General::class, ['application' => $application])
+ ->assertSuccessful()
+ ->set('noindexDomains', ['https://staging.example.com'])
+ ->call('updateNoindexDomains')
+ ->assertDispatched('success');
+
+ expect($application->refresh()->noindexDomains()->all())
+ ->toBe(['https://staging.example.com']);
+ });
+});