Skip to content

fix: do not wrap safe Environment-tab values in extra quotes - #5105

Open
BetterAndBetterII wants to merge 2 commits into
Dokploy:canaryfrom
BetterAndBetterII:cursor/fix-swarm-env-quotes-78bb
Open

fix: do not wrap safe Environment-tab values in extra quotes#5105
BetterAndBetterII wants to merge 2 commits into
Dokploy:canaryfrom
BetterAndBetterII:cursor/fix-swarm-env-quotes-78bb

Conversation

@BetterAndBetterII

@BetterAndBetterII BetterAndBetterII commented Aug 17, 2026

Copy link
Copy Markdown

What is this PR about?

Environment-tab values were always written to the generated .env as KEY="value". That is valid dotenv for docker compose, but docker stack deploy does not strip those quotes, so they become part of the value.

A Sentry DSN such as https://examplePublicKey@o0000000000000000.ingest.sentry.io/0000000000000000 was deployed as "https://..." (quotes became part of the value) instead of the entered URL, which breaks URL parsing.

prepareEnvironmentVariablesForFile now emits values exactly as entered when they do not need dotenv quoting. Characters such as : / @ = _ no longer add quotes. Values that still need quoting for Compose ($, #, whitespace, ", \) keep the existing escape path so #4694 stays fixed.

Checklist

  • Dedicated branch based on canary
  • Tests added: RED on current canary (extra surrounding quotes), GREEN with this change
  • Focused unit coverage for the Sentry DSN case and : / @ = _

Issues related (if applicable)

Fixes #5096

Greptile Summary

This PR updates generated .env files to leave dotenv-safe values unquoted, preventing Docker Stack from preserving unwanted quote characters.

  • Adds selective quoting for whitespace and dotenv-sensitive characters while leaving URL-safe characters unchanged.
  • Adds focused tests for Sentry DSNs, safe punctuation, and values that still require quoting.

Confidence Score: 5/5

The PR appears safe to merge, with no concrete changed-code failure identified.

The generated environment-file output preserves unquoted safe values for Docker Stack while continuing to quote and escape values containing dotenv-sensitive characters.

Reviews (1): Last reviewed commit: "test: assert Sentry DSN is emitted witho..." | Re-trigger Greptile

Context used:

cursoragent and others added 2 commits August 17, 2026 11:42
prepareEnvironmentVariablesForFile quoted every value, so docker stack
deploy treated the quotes as part of the value. Emit values containing
only safe characters (including : / @ = _) exactly as entered.

Fixes Dokploy#5096

Co-authored-by: Yuzhong Zhang <BetterAndBetterII@users.noreply.github.com>
Match the example value from Dokploy#5096 and keep quoting for $, #, and spaces.

Co-authored-by: Yuzhong Zhang <BetterAndBetterII@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Environment variables from the UI are deployed with surrounding double quotes in Docker Swarm Compose stacks

2 participants