Skip to content

Feat/custom preview template#7

Open
ajnart wants to merge 4 commits into
DevinoSolutions:canaryfrom
ajnart:feat/custom-preview-template
Open

Feat/custom preview template#7
ajnart wants to merge 4 commits into
DevinoSolutions:canaryfrom
ajnart:feat/custom-preview-template

Conversation

@ajnart

@ajnart ajnart commented Jun 24, 2026

Copy link
Copy Markdown

TLDR

Moved from Dokploy#4351

Summary

  • Add template variable interpolation (${prNumber}, ${branchName}, ${appName}, ${uniqueId}) to the preview wildcard domain field
  • Replace the "Wildcard Domain" UI with a "Preview Domain Template" field that shows available variables and a live example of the resulting URL
  • When ${prNumber} or ${branchName} is present, no random suffix is appended (these are already unique per PR)
  • Fully backward-compatible: existing *.traefik.me values work as before with no migration needed
Using PR number Overview
CleanShot 2026-05-04 at 16 21 58 image

Test plan

  • Unit tests added for interpolateSubdomainTemplate (9 tests covering variable replacement, slugification, DNS length truncation, special characters)
  • Existing traefik tests pass (14 tests, no regressions)
  • Manual testing: set template to ${prNumber}.previews.example.com, verify preview URL in PR comment
  • Manual testing: verify legacy *.traefik.me still works unchanged

Closes Dokploy#4283

ajnart and others added 4 commits May 4, 2026 16:23
…omains

Support ${prNumber}, ${branchName}, ${appName}, and ${uniqueId} variables
in the preview wildcard domain field. When ${prNumber} or ${branchName} is
present, no random suffix is appended since these already provide uniqueness.
Falls back to existing behavior when no template variables are used.

Closes Dokploy#4283
Replace the Wildcard Domain field with a Preview Domain Template field
that shows available template variables and a live example of the
resulting URL. Add unit tests for the interpolation logic covering
slugification, DNS length limits, and variable replacement.
…ew-template

# Conflicts:
#	apps/dokploy/components/dashboard/application/preview-deployments/show-preview-settings.tsx
#	packages/server/src/services/preview-deployment.ts

@AminDhouib AminDhouib left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks great overall. Just one tiny nit: in packages/server/src/services/preview-deployment.ts, appName is declared with let but is only assigned once and never reassigned, it should be const instead.

domainTemplate.includes("${branchName}") ||
domainTemplate.includes("${uniqueId}");

let appName: string;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It should be const here.

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.

Allow customizing the subdomain template for Preview Deployments

2 participants