Skip to content

[#2546] Made the Lagoon amazee.io trusted-host region configurable.#2577

Merged
AlexSkrypnyk merged 4 commits into
mainfrom
feature/2546-lagoon-host-region
Jun 5, 2026
Merged

[#2546] Made the Lagoon amazee.io trusted-host region configurable.#2577
AlexSkrypnyk merged 4 commits into
mainfrom
feature/2546-lagoon-host-region

Conversation

@AlexSkrypnyk
Copy link
Copy Markdown
Member

@AlexSkrypnyk AlexSkrypnyk commented Jun 5, 2026

Closes #2546

Summary

The Lagoon settings file hardcoded the Australian amazee.io region (^.+\.au\.amazee\.io$) in trusted_host_patterns, forcing consumers on other amazee.io regions to edit a block marked "do not modify" and leaving everyone with a broad wildcard for a region they may not use. This makes the region configurable via a new VORTEX_LAGOON_AMAZEEIO_REGION variable that defaults to au, so existing behavior is byte-identical, while other regions can be selected and projects that do not run on amazee.io can opt out entirely.

Changes

Lagoon settings (web/sites/default/includes/providers/settings.lagoon.php)

  • Replaces the hardcoded ^.+\.au\.amazee\.io$ pattern with a block driven by VORTEX_LAGOON_AMAZEEIO_REGION.
  • When the variable is unset, the region defaults to au, producing the exact same pattern as before (no regression).
  • The region value is escaped with preg_quote() before being embedded in the pattern, matching the escaping already used in the sibling settings.trusted_hosts.php.
  • An empty value skips the pattern entirely, for projects that do not run on amazee.io and should not carry the wildcard.
$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$';
}

Configuration and docs

  • Adds VORTEX_LAGOON_AMAZEEIO_REGION=au to the HOSTING_LAGOON block in .env, next to VORTEX_LAGOON_PRODUCTION_BRANCH, giving consumers a discoverable override point.
  • Regenerates the variables reference, which now lists the new variable (sourced from .env).
  • Regenerates the five Lagoon installer fixtures affected by the settings and .env changes.

Before / After

trusted_host_patterns[] for the Lagoon internal route

Before
------
  '^.+\.au\.amazee\.io$'                      # hardcoded, AU region only

After
-----
  region = getenv('VORTEX_LAGOON_AMAZEEIO_REGION')
  unset    -> 'au'  -> '^.+\.au\.amazee\.io$'  # unchanged default
  'us'              -> '^.+\.us\.amazee\.io$'
  '' (empty)        -> (pattern skipped)

Summary by CodeRabbit

  • New Features

    • Added a configurable amazee.io hosting region via a new environment setting; defaults to "au" when unset, enabling region-specific trusted host handling.
  • Documentation

    • Updated configuration docs to describe the new region setting and how to configure it.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 5, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 95ae1dff-6e95-42cc-b4ae-f17a296ecd29

📥 Commits

Reviewing files that changed from the base of the PR and between 7bcd594 and a23b717.

⛔ Files ignored due to path filters (5)
  • .vortex/installer/tests/Fixtures/handler_process/hosting_lagoon/web/sites/default/includes/providers/settings.lagoon.php is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/hosting_project_name___lagoon/web/sites/default/includes/providers/settings.lagoon.php is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/migration_disabled_lagoon/web/sites/default/includes/providers/settings.lagoon.php is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/migration_enabled_lagoon/web/sites/default/includes/providers/settings.lagoon.php is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/provision_database_lagoon/web/sites/default/includes/providers/settings.lagoon.php is excluded by !.vortex/installer/tests/Fixtures/**
📒 Files selected for processing (1)
  • web/sites/default/includes/providers/settings.lagoon.php

Walkthrough

Adds VORTEX_LAGOON_AMAZEEIO_REGION to .env, uses it in Lagoon provider settings to generate the amazee.io trusted-host regex (defaulting to au), and documents the new variable.

Changes

Lagoon amazee.io Region Configuration

Layer / File(s) Summary
Configurable Lagoon amazee.io region
.env, web/sites/default/includes/providers/settings.lagoon.php, .vortex/docs/content/development/variables.mdx
Adds VORTEX_LAGOON_AMAZEEIO_REGION (default au) to .env, updates settings.lagoon.php to read the variable, default to au when unset/false, and conditionally append an escaped ^.+\.<region>\.amazee\.io$ trusted-host pattern; documents the variable in the variables guide.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 I sniffed a hardcoded ebb and flow,
A region stuck to "au" you know.
Now a little variable hops in place,
.env to settings, a flexible trace.
Hooray—no more region-only woe! 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely describes the main change: making the Lagoon amazee.io trusted-host region configurable via a new environment variable.
Linked Issues check ✅ Passed All coding requirements from issue #2546 are met: the hardcoded au region is replaced with a configurable VORTEX_LAGOON_AMAZEEIO_REGION variable, the region value is safely escaped, and existing behavior is preserved.
Out of Scope Changes check ✅ Passed All changes are directly related to the stated objective: adding the environment variable, documenting it, updating the Lagoon provider settings, and regenerating affected fixtures.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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/2546-lagoon-host-region

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

@github-actions

This comment has been minimized.

@AlexSkrypnyk

This comment has been minimized.

2 similar comments
@AlexSkrypnyk

This comment has been minimized.

@AlexSkrypnyk

This comment has been minimized.

@github-actions

This comment has been minimized.

@AlexSkrypnyk

This comment has been minimized.

2 similar comments
@AlexSkrypnyk

This comment has been minimized.

@AlexSkrypnyk

This comment has been minimized.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.11%. Comparing base (0cc8aab) to head (a23b717).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2577      +/-   ##
==========================================
- Coverage   86.56%   86.11%   -0.45%     
==========================================
  Files          94       87       -7     
  Lines        4660     4502     -158     
  Branches       47        3      -44     
==========================================
- Hits         4034     3877     -157     
+ Misses        626      625       -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.

@AlexSkrypnyk AlexSkrypnyk enabled auto-merge (squash) June 5, 2026 11:09
@AlexSkrypnyk AlexSkrypnyk added the AUTOMERGE Pull request has been approved and set to automerge label Jun 5, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 5, 2026

Code coverage (threshold: 90%)

  Classes: 100.00% (1/1)
  Methods: 100.00% (2/2)
  Lines:   98.56% (205/208)
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.56% (205/208)
Per-class coverage
Drupal\ys_demo\Plugin\Block\CounterBlock
  Methods: 100.00% ( 2/ 2)   Lines: 100.00% ( 10/ 10)

@AlexSkrypnyk AlexSkrypnyk merged commit 3f946c4 into main Jun 5, 2026
33 checks passed
@AlexSkrypnyk AlexSkrypnyk deleted the feature/2546-lagoon-host-region branch June 5, 2026 11:23
@github-project-automation github-project-automation Bot moved this from BACKLOG to Release queue in Vortex Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AUTOMERGE Pull request has been approved and set to automerge

Projects

Status: Release queue

Development

Successfully merging this pull request may close these issues.

Make the hardcoded Lagoon au.amazee.io trusted-host pattern configurable

1 participant