diff --git a/apps/dokploy/__test__/compose/env-file-literals.test.ts b/apps/dokploy/__test__/compose/env-file-literals.test.ts index 2dbb7fa4e..91af553a1 100644 --- a/apps/dokploy/__test__/compose/env-file-literals.test.ts +++ b/apps/dokploy/__test__/compose/env-file-literals.test.ts @@ -32,6 +32,8 @@ const cases: Record = { APOSTROPHE: "it's a test", UNICODE: "héllo wörld 日本語 🚀", MULTILINE_PEM: "-----BEGIN KEY-----\nabc123\n-----END KEY-----", + APP_URL: "https://example.com", + ASSET_URL: "https://example.com", }; // How each value must be typed in the UI so the (unchanged) dotenv input @@ -46,6 +48,8 @@ const inputEncoding: Record = { APOSTROPHE: "it's a test", UNICODE: "héllo wörld 日本語 🚀", MULTILINE_PEM: '"-----BEGIN KEY-----\nabc123\n-----END KEY-----"', + APP_URL: "https://example.com", + ASSET_URL: '"${APP_URL}"', }; describe("getCreateEnvFileCommand", () => { diff --git a/packages/server/src/utils/docker/utils.ts b/packages/server/src/utils/docker/utils.ts index fccd979fd..e81030f97 100644 --- a/packages/server/src/utils/docker/utils.ts +++ b/packages/server/src/utils/docker/utils.ts @@ -548,7 +548,7 @@ export const prepareEnvironmentVariablesForFile = ( const escapedValue = value .replace(/\\/g, "\\\\") .replace(/"/g, '\\"') - .replace(/\$/g, "\\$"); + .replace(/\$(?!\{[A-Za-z_][A-Za-z0-9_]*\})/g, "\\$"); return `${key}="${escapedValue}"`; }); };