fix(stacks): apply env override file on stop/down for git stacks (#1313)

startStack and restartStack compute isGitStack and pass useOverrideFile
accordingly, so executeLocalCompose writes .env.dockhand with the DB
non-secret overrides before invoking docker compose. stopStack and
downStack never set this option, so whenever a .env file exists in the
stack's working directory (e.g. committed alongside compose.yaml in a
git stack), the legacy shell-env fallback in executeLocalCompose is
suppressed and .env.dockhand is never written or attached via
--env-file. Any required variable that only exists as a Dockhand panel
override then fails interpolation on stop/down, even though the same
stack deploys and starts successfully.

Mirror startStack/restartStack: compute isGitStack from the stack
source and pass useOverrideFile through in both operations.
This commit is contained in:
Björn Strausmann authored and Jarek Krochmalski committed 2026-07-31 04:58:47 +02:00
1 parent f24f42116e
commit 144a73a10a
1 file changed
+10 -2
+10 -2
View File
@@ -2212,9 +2212,13 @@ export async function stopStack(
return fallback;
}
// Check if this is a git stack - git stacks need useOverrideFile to write .env.dockhand
const source = await getStackSource(stackName, envId);
const isGitStack = source?.sourceType === 'git';
const composeResult = await executeComposeCommand(
'stop',
{ stackName, envId, workingDir: result.stackDir, composePath: result.composePath, envPath: result.envPath },
{ stackName, envId, workingDir: result.stackDir, composePath: result.composePath, envPath: result.envPath, useOverrideFile: isGitStack },
result.content!,
result.nonSecretVars,
result.secretVars
@@ -2289,9 +2293,13 @@ export async function downStack(
return withContainerFallback(stackName, envId, 'stop');
}
// Check if this is a git stack - git stacks need useOverrideFile to write .env.dockhand
const source = await getStackSource(stackName, envId);
const isGitStack = source?.sourceType === 'git';
const composeResult = await executeComposeCommand(
'down',
{ stackName, envId, removeVolumes, workingDir: result.stackDir, composePath: result.composePath, envPath: result.envPath },
{ stackName, envId, removeVolumes, workingDir: result.stackDir, composePath: result.composePath, envPath: result.envPath, useOverrideFile: isGitStack },
result.content!,
result.nonSecretVars,
result.secretVars