fixxxxx
This commit is contained in:
@@ -374,13 +374,26 @@ in
|
|||||||
RemainAfterExit = true;
|
RemainAfterExit = true;
|
||||||
};
|
};
|
||||||
script = ''
|
script = ''
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
if [ ! -d "${cfg.source}" ]; then
|
||||||
|
echo "wafrn-nix: source directory does not exist: ${cfg.source}" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
if [ ! -f "${cfg.source}/package-lock.json" ]; then
|
if [ ! -f "${cfg.source}/package-lock.json" ]; then
|
||||||
echo "wafrn-nix: package-lock.json missing, generating with npm" >&2
|
echo "wafrn-nix: package-lock.json missing, generating with npm" >&2
|
||||||
(cd "${cfg.source}" && npm install --package-lock-only --ignore-scripts)
|
if ! (cd "${cfg.source}" && npm install --package-lock-only --ignore-scripts); then
|
||||||
|
echo "wafrn-nix: failed to generate package-lock.json, continuing with existing source" >&2
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
install -m 0600 ${envTemplate} ${serviceEnvFile}
|
install -m 0600 ${envTemplate} ${serviceEnvFile}
|
||||||
${optionalString (cfg.secretsFile != null) ''
|
${optionalString (cfg.secretsFile != null) ''
|
||||||
|
if [ ! -f "${cfg.secretsFile}" ]; then
|
||||||
|
echo "wafrn-nix: secretsFile does not exist: ${cfg.secretsFile}" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
cat "${cfg.secretsFile}" >> ${serviceEnvFile}
|
cat "${cfg.secretsFile}" >> ${serviceEnvFile}
|
||||||
''}
|
''}
|
||||||
install -m 0644 ${composeTemplate} ${composeFile}
|
install -m 0644 ${composeTemplate} ${composeFile}
|
||||||
|
|||||||
Reference in New Issue
Block a user