Skip to content

fix: Parse service relationship string format correctly, fixes #10, fixes #22#23

Merged
rfay merged 1 commit intomainfrom
20260203_service_relationship_mapping
Feb 4, 2026
Merged

fix: Parse service relationship string format correctly, fixes #10, fixes #22#23
rfay merged 1 commit intomainfrom
20260203_service_relationship_mapping

Conversation

@rfay
Copy link
Member

@rfay rfay commented Feb 4, 2026

The Issue

The add-on failed to parse Upsun configurations using the official pattern where relationship values reference service names (e.g., mariadb: 'db:mysql'). Only non-standard configurations where the service name matched the database type worked by accident.

How This PR Solves The Issue

Updated UpsunConfigParser::getDatabaseConfig() to parse relationship string format 'service_name:endpoint' by extracting the service name and looking it up in the services configuration, matching the pattern already implemented in FixedConfigParser. This handles the official Upsun pattern while maintaining backward compatibility with existing configurations.

Also added trim() to Redis config parser for consistency.

Manual Testing Instructions

ddev add-on get https://github.com/ddev/ddev-upsun/tarball/refs/pull/23/head
ddev restart

Automated Testing Overview

Added new test fixture mariadb-generic-flex that uses generic service name 'db' instead of 'mariadb', and added corresponding test case to drupal11-unified.bats. All existing tests continue to pass, verifying backward compatibility.

…ixes #22

## The Issue

The add-on failed to parse Upsun configurations using the official pattern where relationship values reference service names (e.g., mariadb: 'db:mysql'). Only non-standard configurations where the service name matched the database type worked by accident.

## How This PR Solves The Issue

Updated UpsunConfigParser::getDatabaseConfig() to parse relationship string format 'service_name:endpoint' by extracting the service name and looking it up in the services configuration, matching the pattern already implemented in FixedConfigParser. This handles the official Upsun pattern while maintaining backward compatibility with existing configurations.

Also added trim() to Redis config parser for consistency.

## Automated Testing Overview

Added new test fixture mariadb-generic-flex that uses generic service name 'db' instead of 'mariadb', and added corresponding test case to drupal11-unified.bats. All existing tests continue to pass, verifying backward compatibility.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@rfay rfay changed the title fix: Parse service relationship string format correctly, fixes #10, fxes #22 fix: Parse service relationship string format correctly, fixes #10, fixes #22 Feb 4, 2026
@rfay rfay requested a review from stasadev February 4, 2026 12:24
Copy link
Member

@stasadev stasadev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@rfay rfay merged commit 6b5599a into main Feb 4, 2026
12 checks passed
@rfay rfay deleted the 20260203_service_relationship_mapping branch February 4, 2026 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants