@stacksjs/buddy 0.70.183 → 0.70.184
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/deploy.js +13 -1
- package/package.json +1 -1
package/dist/commands/deploy.js
CHANGED
|
@@ -945,6 +945,11 @@ fi
|
|
|
945
945
|
if [ -n "$FWD_B64" ] && [ -x /usr/local/bin/bun ]; then
|
|
946
946
|
echo "$FWD_B64" | base64 -d > /tmp/.mailtenant-fwd.json
|
|
947
947
|
echo "$README_B64" | base64 -d > /tmp/.mailtenant-readme.txt
|
|
948
|
+
# \`let\`, not \`const\`: both of these were const with an assignment inside a
|
|
949
|
+
# try, which Bun rejects at parse time ("this assignment will throw because
|
|
950
|
+
# X is a constant"). The whole snippet therefore never ran, stderr was sent
|
|
951
|
+
# to /dev/null, and every reconcile since has reported forwards=nochange
|
|
952
|
+
# while forwards.json sat untouched.
|
|
948
953
|
/usr/local/bin/bun --bun -e '
|
|
949
954
|
const fs=require("fs"); const f="/opt/mail/forwards.json";
|
|
950
955
|
const cur={}; try{cur=JSON.parse(fs.readFileSync(f,"utf8"))}catch{}
|
|
@@ -956,7 +961,11 @@ if [ -n "$FWD_B64" ] && [ -x /usr/local/bin/bun ]; then
|
|
|
956
961
|
const s=JSON.stringify(out,null,2)+"\\n";
|
|
957
962
|
const prev=""; try{prev=fs.readFileSync(f,"utf8")}catch{}
|
|
958
963
|
if(s!==prev){ fs.writeFileSync(f,s); process.stdout.write("FWDCHANGED"); }
|
|
959
|
-
' > /tmp/.mailtenant-res 2>/
|
|
964
|
+
' > /tmp/.mailtenant-res 2>/tmp/.mailtenant-err || true
|
|
965
|
+
# A merge that failed is worth one line, not silence: the rules decide where
|
|
966
|
+
# mail goes.
|
|
967
|
+
if [ -s /tmp/.mailtenant-err ]; then echo "FWDERR:$(head -c 200 /tmp/.mailtenant-err | tr '\\n' ' ')"; fi
|
|
968
|
+
rm -f /tmp/.mailtenant-err
|
|
960
969
|
chown mail-server:mail-server "$FJSON" 2>/dev/null || true
|
|
961
970
|
chmod 644 "$FJSON" 2>/dev/null || true
|
|
962
971
|
rm -f /tmp/.mailtenant-fwd.json /tmp/.mailtenant-readme.txt
|
|
@@ -1027,6 +1036,9 @@ if [ "$ENV_CHANGED" = 1 ]; then systemctl restart mail 2>/dev/null || true; echo
|
|
|
1027
1036
|
const failed = [...out.matchAll(/FAIL:([^\n]+)/g)].flatMap((m) => m[1] ? [m[1].trim()] : []);
|
|
1028
1037
|
if (failed.length)
|
|
1029
1038
|
logger.warn(`Mail: the server refused ${failed.length} mailbox(es): ${failed.join(", ")}`);
|
|
1039
|
+
const forwardError = (out.match(/FWDERR:([^\n]*)/) || [])[1]?.trim();
|
|
1040
|
+
if (forwardError)
|
|
1041
|
+
logger.warn(`Mail: the forward rules were not merged: ${forwardError}`);
|
|
1030
1042
|
const seen = new Set([...madeAddrs, ...[...out.matchAll(/EXISTS:([^\n]+)/g)].flatMap((m) => m[1] ? [m[1].trim()] : [])]), unaccounted = boxes.filter((b) => !seen.has(b.address)).map((b) => b.address);
|
|
1031
1043
|
if (unaccounted.length)
|
|
1032
1044
|
logger.warn(`Mail: ${unaccounted.length} declared mailbox(es) were not reconciled: ${unaccounted.join(", ")}`);
|