Skip to content

Add wildcard subdomain matching in config host sections#374

Merged
ryanfowler merged 1 commit intomainfrom
wildcard-config
Jan 30, 2026
Merged

Add wildcard subdomain matching in config host sections#374
ryanfowler merged 1 commit intomainfrom
wildcard-config

Conversation

@ryanfowler
Copy link
Owner

Support [*.example.com] syntax to match any subdomain of a domain. Exact matches take priority, and when multiple wildcards match, the most specific (longest suffix) wins.

Support [*.example.com] syntax to match any subdomain of a domain.
Exact matches take priority, and when multiple wildcards match, the
most specific (longest suffix) wins.
@ryanfowler ryanfowler requested a review from Copilot January 30, 2026 02:00
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds wildcard subdomain matching support to the host configuration sections, allowing patterns like [*.example.com] to match any subdomain of a domain. Exact hostname matches take priority, and when multiple wildcard patterns match, the most specific (longest suffix) is selected.

Changes:

  • Implemented validation for wildcard hostname patterns in the config parser
  • Added HostConfig() method to resolve hostname configurations with wildcard matching logic
  • Updated configuration lookup to use the new wildcard-aware resolution method

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
main.go Refactored config lookup to use the new HostConfig() method instead of direct map access
internal/config/file.go Added wildcard validation logic and implemented HostConfig() method for wildcard-aware hostname resolution
internal/config/file_test.go Added comprehensive test coverage for wildcard validation and hostname matching scenarios
docs/configuration.md Added documentation explaining wildcard subdomain matching syntax and matching rules

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ryanfowler ryanfowler merged commit 73b32e1 into main Jan 30, 2026
10 checks passed
@ryanfowler ryanfowler deleted the wildcard-config branch January 30, 2026 02: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.

1 participant