Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add support for multiple hostnames #25

Conversation

stasadev
Copy link
Contributor

@stasadev stasadev commented Jan 7, 2025

The Issue

From Discord: https://discord.com/channels/664580571770388500/1326111991642718301

external_links don't work properly when you have additional_hostnames or additional_fqdns.

external_links:
- ddev-router:${DDEV_HOSTNAME}

 external_links: 
   - "ddev-router:${DDEV_HOSTNAME}"

It is expanded with an invalid syntax:

 external_links: 
   - "ddev-router:primary.ddev.site,secondary.ddev.site"

It should look like this:

 external_links: 
   - "ddev-router:primary.ddev.site"
   - "ddev-router:secondary.ddev.site"

How This PR Solves The Issue

Uses go templates to create the correct external_links in .ddev/docker-compose.playwright_extras.yaml

Manual Testing Instructions

This allows for example to have Mailpit to work automatically without any port change.

mkdir playwright-test && cd playwright-test
ddev config --additional-fqdns="hello.test" --additional-hostnames "extra1,extra2,more.extra"
echo '<?php echo "Hello World;"; ?>' > index.php
ddev add-on get https://github.com/stasadev/ddev-playwright/tarball/20250107_stasadev_external_links

cat .ddev/docker-compose.playwright_extras.yaml
#ddev-generated
services:
  playwright:
    external_links:
      - "ddev-router:${DDEV_PROJECT}.${DDEV_TLD}"
      - "ddev-router:extra1.${DDEV_TLD}"
      - "ddev-router:extra2.${DDEV_TLD}"
      - "ddev-router:hello.test"
      - "ddev-router:more.extra.${DDEV_TLD}"

ddev start

cat .ddev/.ddev-docker-compose-full.yaml
        external_links:
            - ddev-router:playwright-test.ddev.site
            - ddev-router:extra1.ddev.site
            - ddev-router:extra2.ddev.site
            - ddev-router:hello.test
            - ddev-router:more.extra.ddev.site

Related Issue Link(s)

@julienloizelet julienloizelet self-assigned this Jan 8, 2025
@julienloizelet julienloizelet merged commit f207228 into julienloizelet:main Jan 8, 2025
3 checks passed
@julienloizelet
Copy link
Owner

Thanks for the PR!

@stasadev stasadev deleted the 20250107_stasadev_external_links branch January 8, 2025 07:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants