Refactor JSON handling in check_certificates.sh to simplify domain entry updates
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
gyurix
2025-03-15 00:20:02 +01:00
parent 6f2a6ed610
commit c402e960be

View File

@@ -31,8 +31,8 @@ create_json() {
jq '
if . == null or . == [] then
{"'$DOMAIN'":{"date": "'$DATE'", "status": "'$STATUS'", "log": "'$LOG'"}}
else
(map(select(has("'$DOMAIN'") | not)) | from_entries) + {"'$DOMAIN'": {"date": "'$DATE'", "status": "'$STATUS'", "log": "'$LOG'" }}
else
. + {"'$DOMAIN'": {"date": "'$DATE'", "status": "'$STATUS'", "log": "'$LOG'"}}
end
' $LETSENCRYPT_OUTPUT >$TMP_FILE
cat $TMP_FILE >$LETSENCRYPT_OUTPUT