Skip to content

feat(templates): support importing blueprint/templates with domain initially inactive (#5390) - #5445

Open
fliptrigga13 wants to merge 1 commit into
Dokploy:canaryfrom
fliptrigga13:fix/issue-5390-template-inactive-domains
Open

fliptrigga13 wants to merge 1 commit into
Dokploy:canaryfrom
fliptrigga13:fix/issue-5390-template-inactive-domains

Conversation

@fliptrigga13

@fliptrigga13 fliptrigga13 commented Sep 13, 2026

Copy link
Copy Markdown

Summary

Fixes #5390

Problem

When importing blueprints and templates (e.g. Elasticsearch + Kibana stacks), some companion services are internal-only or optional (such as the raw Elasticsearch REST API port) while others are user-facing (like the Kibana web dashboard). Maintainers and users wanted to pre-configure domain routing for these services in the template without immediately exposing them to the internet until explicitly activated by the administrator.

While PR #4697 introduced domain enabling/disabling capabilities for existing domains, blueprint and template importing had no mechanism to mark domains initially inactive.

Solution

  1. Extended DomainConfig in packages/server/src/templates/processors.ts with optional active?: boolean and enabled?: boolean fields.
  2. Updated processDomains to propagate the initial enabled state (defaulting to true if neither is specified, but respecting false when either active = false or enabled = false is defined).
  3. Added enabled: true to apiCreateDomain in packages/server/src/db/schema/domain.ts, allowing domains created during template deployment and project cloning to preserve their configured status.
  4. Added unit test suite in apps/dokploy/__test__/templates/template-inactive-domain.test.ts covering active/inactive configurations and precedence rules (4/4 tests passing).

RetriggerConfidence Score: 4/5

The PR is not yet safe to merge because a realistically quoted false value can enable and externally route a domain intended to remain inactive.

Summary

  • Adds active and enabled support to template domain processing.
  • Extends the domain creation schema to accept the enabled state.
  • Adds tests for false values, defaults, and precedence, though those tests currently exercise a copied helper rather than production code.

Reviews (1) · Last reviewed commit: "feat(templates): support importing bluep..."

Comment on lines +247 to +252
enabled:
domain.enabled !== undefined
? Boolean(domain.enabled)
: domain.active !== undefined
? Boolean(domain.active)
: true,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Quoted False Becomes Enabled

When an imported TOML or JSON blueprint contains a quoted boolean such as enabled = "false" or active = "false", no runtime validation rejects or normalizes the string. Because Boolean("false") evaluates to true, the domain is persisted as enabled and included in generated Traefik routing, exposing a service that the template author intended to keep inactive.

Comment on lines +18 to +40
function processDomains(
template: CompleteTemplate,
variables: Record<string, string>,
): Array<DomainConfig & { enabled: boolean; host: string }> {
if (
!template?.config?.domains ||
template.config.domains.length === 0 ||
template.config.domains.every((domain) => !domain.serviceName)
) {
return [];
}

return template.config.domains.map((domain: DomainConfig) => ({
...domain,
enabled:
domain.enabled !== undefined
? Boolean(domain.enabled)
: domain.active !== undefined
? Boolean(domain.active)
: true,
host: domain.host || "test.example.com",
}));
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Tests Bypass Production Code

These tests exercise a local copy of processDomains instead of the exported production implementation. They will continue passing if the real enabled/active precedence or defaulting logic regresses, leaving this feature without effective regression coverage. Import and test the production processor, as the neighboring template tests already do.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

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.

Support importing blueprint/templates with domain initially inactive

1 participant