Skip to content

Simplified the Lagoon amazee.io trusted-host pattern and removed 'VORTEX_LAGOON_AMAZEEIO_REGION'.#2716

Merged
AlexSkrypnyk merged 5 commits into
mainfrom
feature/lagoon-amazee-host
Jun 25, 2026
Merged

Simplified the Lagoon amazee.io trusted-host pattern and removed 'VORTEX_LAGOON_AMAZEEIO_REGION'.#2716
AlexSkrypnyk merged 5 commits into
mainfrom
feature/lagoon-amazee-host

Conversation

@AlexSkrypnyk

@AlexSkrypnyk AlexSkrypnyk commented Jun 25, 2026

Copy link
Copy Markdown
Member

N/A

Summary

This simplifies the Lagoon amazee.io trusted-host handling by replacing the configurable VORTEX_LAGOON_AMAZEEIO_REGION region knob (introduced in #2577 for #2546) with a single unconditional trusted_host_patterns entry ^.+\.amazee\.io$. The region knob existed only to un-hardcode the old ^.+\.au\.amazee\.io$ pattern so non-AU consumers were not forced to edit a "do not modify" block; collapsing it to a region-agnostic wildcard removes that friction and the extra variable entirely. VORTEX_LAGOON_AMAZEEIO_REGION becomes a no-op and consumers can delete it from their .env.

Changes

web/sites/default/includes/providers/settings.lagoon.php

The getenv('VORTEX_LAGOON_AMAZEEIO_REGION') block (default au, preg_quote-built pattern, skip-if-empty guard) collapses to a single line: $settings['trusted_host_patterns'][] = '^.+\.amazee\.io$'; with a comment explaining it trusts amazee.io's autogenerated internal routes.

.env

Removes VORTEX_LAGOON_AMAZEEIO_REGION and its comment block from the HOSTING_LAGOON fence.

.vortex/docs/content/development/variables.mdx

Removes the VORTEX_LAGOON_AMAZEEIO_REGION row (regenerated via ahoy update-docs).

tests/phpunit/Drupal/EnvironmentSettingsTest.php

Updates the expected trusted_host_patterns from ^.+\.au\.amazee\.io$ to ^.+\.amazee\.io$ in all four Lagoon scenarios (testEnvironmentLagoonPreview, testEnvironmentLagoonDev, testEnvironmentLagoonTest, testEnvironmentLagoonProd) so the assertions match the settings change. None of these scenarios set the region variable, so all four previously asserted the au default.

Installer test fixtures (5 Lagoon scenarios: hosting_lagoon, hosting_project_name___lagoon, migration_disabled_lagoon, migration_enabled_lagoon, provision_database_lagoon)

Regenerated the .env, settings.lagoon.php, and EnvironmentSettingsTest.php fixtures via ahoy update-snapshots; verified clean on a second pass (139/139 scenarios pass).

Compatibility and security note

  • AU consumers (the previous default) see no regression: *.au.amazee.io is a subset of *.amazee.io and remains trusted.
  • Non-AU consumers now work out of the box without editing the settings block.
  • This broadens the trusted-host wildcard from one amazee.io region to all amazee.io regions. The practical impact is negligible: Lagoon ingress routes by Host, so an external request cannot deliver an arbitrary *.amazee.io Host to this environment's pod, and trusted_host_patterns is defense-in-depth rather than the primary control.
  • Worth a release note: VORTEX_LAGOON_AMAZEEIO_REGION is a documented variable that has been removed.

Before / After

BEFORE - configurable region knob:

  $amazeeio_region = getenv('VORTEX_LAGOON_AMAZEEIO_REGION');
  if ($amazeeio_region === FALSE) { $amazeeio_region = 'au'; }
  if (!empty($amazeeio_region)) {
    $settings['trusted_host_patterns'][] = '^.+\.' . preg_quote($amazeeio_region, '/') . '\.amazee\.io$';
  }

  region = "au"  ->  ^.+\.au\.amazee\.io$   (default)
  region = "us"  ->  ^.+\.us\.amazee\.io$   (manual override needed)
  region = ""    ->  (skipped - non-amazee.io deployments broken silently)

  .env: VORTEX_LAGOON_AMAZEEIO_REGION=au    (consumers must know region)

AFTER - single unconditional wildcard:

  // Trust amazee.io's autogenerated internal routes, served under *.amazee.io.
  $settings['trusted_host_patterns'][] = '^.+\.amazee\.io$';

  all regions   ->  ^.+\.amazee\.io$         (covers au, us, and any future region)

  .env: (variable removed entirely)

Summary by CodeRabbit

  • Bug Fixes

    • Expanded trusted host support for Lagoon environments so autogenerated internal routes on *.amazee.io load correctly.
    • Updated environment checks to reflect the broader trusted host pattern across Preview, Dev, Test, and Prod.
  • Documentation

    • Cleaned up the environment variable list by removing an outdated entry.
    • Added the current production branch setting to the configuration reference.

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The Lagoon trusted-host regex now allows any *.amazee.io route, the related PHPUnit expectations were updated, and the Lagoon environment variable list now includes VORTEX_LAGOON_PRODUCTION_BRANCH while removing the VORTEX_LAGOON_AMAZEEIO_REGION documentation entry.

Changes

Lagoon configuration and host trust

Layer / File(s) Summary
Environment variable surface
.env, .vortex/docs/content/development/variables.mdx
Adds VORTEX_LAGOON_PRODUCTION_BRANCH=main to the Lagoon environment block and removes the VORTEX_LAGOON_AMAZEEIO_REGION entry from the variables list.
Lagoon trusted host pattern update
web/sites/default/includes/providers/settings.lagoon.php, tests/phpunit/Drupal/EnvironmentSettingsTest.php
Replaces the region-based Lagoon amazee.io host regex with ^.+\.amazee\.io$ in settings and updates the preview, dev, test, and prod PHPUnit expectations.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • drevops/vortex#2577: Updates the same Lagoon trusted-host logic by removing the region-specific VORTEX_LAGOON_AMAZEEIO_REGION pattern and adjusting the corresponding PHPUnit expectations.

Poem

🐰 I hopped through Lagoon with a springy bound,
*.amazee.io now circles round.
A branch named main sits neat and true,
While tests say “yes” to the hosts in view.
Thump-thump—my nose twitches, all is sound.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: simplifying Lagoon trusted-host handling and removing the region variable.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/lagoon-amazee-host

Comment @coderabbitai help to get the list of available commands.

@AlexSkrypnyk AlexSkrypnyk added this to the 1.40.0 milestone Jun 25, 2026
@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown

📖 Documentation preview for this pull request has been deployed to Netlify:

https://6a3c935a37f833dbd85ccda1--vortex-docs.netlify.app

This preview is rebuilt on every commit and is not the production documentation site.

@github-actions

This comment has been minimized.

@AlexSkrypnyk

This comment has been minimized.

@AlexSkrypnyk AlexSkrypnyk moved this from BACKLOG to To do for current release in Vortex 1.x Jun 25, 2026
@AlexSkrypnyk

This comment has been minimized.

1 similar comment
@AlexSkrypnyk

This comment has been minimized.

@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.22%. Comparing base (b845ffc) to head (aa47a20).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2716      +/-   ##
==========================================
- Coverage   86.67%   86.22%   -0.45%     
==========================================
  Files          96       89       -7     
  Lines        4719     4560     -159     
  Branches       47        3      -44     
==========================================
- Hits         4090     3932     -158     
+ Misses        629      628       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

Copy link
Copy Markdown

Code coverage (threshold: 90%)

  Classes: 100.00% (1/1)
  Methods: 100.00% (2/2)
  Lines:   98.55% (204/207)
Per-class coverage
Drupal\ys_demo\Plugin\Block\CounterBlock
  Methods: 100.00% ( 2/ 2)   Lines: 100.00% ( 10/ 10)

@AlexSkrypnyk

This comment has been minimized.

2 similar comments
@AlexSkrypnyk

This comment has been minimized.

@AlexSkrypnyk

Copy link
Copy Markdown
Member Author

Code coverage (threshold: 90%)

  Classes: 100.00% (1/1)
  Methods: 100.00% (2/2)
  Lines:   98.55% (204/207)
Per-class coverage
Drupal\ys_demo\Plugin\Block\CounterBlock
  Methods: 100.00% ( 2/ 2)   Lines: 100.00% ( 10/ 10)

@AlexSkrypnyk AlexSkrypnyk added the Needs review Pull request needs a review from assigned developers label Jun 25, 2026
@AlexSkrypnyk AlexSkrypnyk merged commit 98fb956 into main Jun 25, 2026
34 checks passed
@AlexSkrypnyk AlexSkrypnyk deleted the feature/lagoon-amazee-host branch June 25, 2026 02:40
@github-project-automation github-project-automation Bot moved this from To do for current release to Release queue in Vortex 1.x Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs review Pull request needs a review from assigned developers

Projects

Status: Release queue

Development

Successfully merging this pull request may close these issues.

1 participant