Skip to content

feat: resolve ${{service.<name>.fqdn}} cross-service env references#4667

Open
AlessandroCaroli wants to merge 1 commit into
Dokploy:canaryfrom
AlessandroCaroli:feat/cross-service-fqdn-env-refs
Open

feat: resolve ${{service.<name>.fqdn}} cross-service env references#4667
AlessandroCaroli wants to merge 1 commit into
Dokploy:canaryfrom
AlessandroCaroli:feat/cross-service-fqdn-env-refs

Conversation

@AlessandroCaroli

Copy link
Copy Markdown

What

Adds support for referencing another service's public URL from an application's environment variables, e.g. API_URL=${{service.backend.fqdn}}. It resolves to the referenced service's domain URL within the same environment.

Why

Closes the core need in #2028 — services in a project (e.g. a frontend needing its backend's URL) currently can't reference each other's generated FQDN. This is the foundational building block both approaches discussed in the issue need.

How

Extends the existing ${{project.*}} / ${{environment.*}} resolver in prepareEnvironmentVariables with an optional precomputed name → fqdn map. mechanizeDockerContainer builds that map from sibling applications + their domains, and skips the DB lookup entirely when the env has no ${{service. reference. Same ${{...}} syntax and error style as the existing references.

Scope / notes

  • Resolves .fqdn to a service's first domain (https://host). Multi-domain "primary" selection and extra attributes (internal host/port) can be follow-ups.
  • Backend-only, no schema change, no new endpoints.

Testing

Added 6 cases to __test__/env/environment.test.ts (resolution, composition with surrounding text, alongside project/env/self refs, unknown-service error, no-map error, no-op when absent). Full env suite green: 74/74.

Refs #2028

/claim #2028


Disclosure: implemented with AI assistance (Claude), authored + verified locally by the submitter.

Allow an application's environment variables to reference another
service's public URL within the same environment, e.g.
API_URL=${{service.backend.fqdn}}. Resolves to the referenced service's
first domain URL.

Extends the existing ${{project.*}} / ${{environment.*}} resolver in
prepareEnvironmentVariables with an optional precomputed name->fqdn map.
mechanizeDockerContainer builds that map from sibling applications and
their domains, skipping the DB lookup entirely when the env contains no
${{service.* reference. Adds tests covering resolution, composition,
multi-ref, unknown-service and no-map error cases.

Refs Dokploy#2028
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. enhancement New feature or request labels Jun 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant