feat: optional routes mapping for custom subdomain routing #17

Open
Jens Grote wants to merge 2 commits from jensgrote/Forge-Pages:feat/custom-routes-config into main
First-time contributor

Adds an optional routes mapping to config.yml that allows mapping custom subdomains to owner/repo pairs, enabling clean subdomain URLs like homeassistant.example.com instead of owner.example.com/repo.

Changes

  • config.go: Added Routes map[string]RouteConfig to the Config struct
  • page_handler.go: Route lookup before the default host-parsing — if a matching route is found, it serves the configured owner/repo directly

Non-breaking

  • The routes config is optional — default behavior is unchanged
  • Falls back to standard host parsing if no route matches
  • See also: GitHub issue #10 (CNAME allowlisting)

Closes #10

Adds an optional `routes` mapping to `config.yml` that allows mapping custom subdomains to owner/repo pairs, enabling clean subdomain URLs like `homeassistant.example.com` instead of `owner.example.com/repo`. ### Changes - **config.go**: Added `Routes map[string]RouteConfig` to the Config struct - **page_handler.go**: Route lookup before the default host-parsing — if a matching route is found, it serves the configured owner/repo directly ### Non-breaking - The `routes` config is optional — default behavior is unchanged - Falls back to standard host parsing if no route matches ### Related - See also: GitHub issue #10 (CNAME allowlisting) Closes #10
feat: add custom routes config for clean subdomain URLs
Some checks failed
Test / test (pull_request) Has been cancelled
8b3a1b9a0e
New optional 'routes' field in config.yml maps hostnames directly
to owner/repo combinations, bypassing the standard parsing.
Non-breaking: all existing functionality unchanged when routes is empty.

Includes:
- MIT License (upstream Leon Schmidt 2025 + Jens Grote 2026)
- CONTRIBUTORS, scm-info.yml, CycloneDX SBOM
- Updated .gitignore for compiled binary

Upstream: https://code.leon.wtf/leon/Forge-Pages
Fork: https://github.com/JensGrote/forge-pages
Leon Schmidt 2026-06-09 21:49:35 +02:00
chore: removed excess files from PR
All checks were successful
Test / test (pull_request) Successful in 33s
133d56b7b2
Owner

Thanks! I removed some files. Please do not commit files that do not have anything to do with your feature proposal (like a LICENSE and sbom files where you are the maintainer??).

Additionally, this does not close #10, as it describes letting users decide whether a deployment would be accessible via a CNAME. With your changes, it is only configurable server-side. But it's a nice additional feature nonetheless.

Thanks! I removed some files. Please do not commit files that do not have anything to do with your feature proposal (like a LICENSE and sbom files where you are the maintainer??). Additionally, this does not close #10, as it describes letting **users** decide whether a deployment would be accessible via a CNAME. With your changes, it is only configurable server-side. But it's a nice additional feature nonetheless.
Leon Schmidt left a comment

Please don't forget to update the README.md with your changes!

Please don't forget to update the README.md with your changes!
Owner

I'm going to review the rest of the changes later.

I'm going to review the rest of the changes later.
All checks were successful
Test / test (pull_request) Successful in 33s
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u feat/custom-routes-config:jensgrote-feat/custom-routes-config
git switch jensgrote-feat/custom-routes-config
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
leon/Forge-Pages!17
No description provided.