Refactor JSON output handling in start.letsencrypt.sh for improved structure
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -43,9 +43,9 @@ create_json() {
|
||||
TMP_FILE=$(mktemp)
|
||||
jq '
|
||||
if . == null or . == [] then
|
||||
[{"'$DOMAIN'":{"date": "'$DATE'", "status": "'$STATUS'", "log": "'$LOG'"}}]
|
||||
{"'$DOMAIN'":{"date": "'$DATE'", "status": "'$STATUS'", "log": "'$LOG'"}}
|
||||
else
|
||||
(map(select(has("'$DOMAIN'") | not))) + [{"'$DOMAIN'":{"date": "'$DATE'", "status": "'$STATUS'", "log": "'$LOG'"}}]
|
||||
(map(select(has("'$DOMAIN'") | not))) + {"'$DOMAIN'":{"date": "'$DATE'", "status": "'$STATUS'", "log": "'$LOG'"}}
|
||||
end
|
||||
' $LETSENCRYPT_OUTPUT >$TMP_FILE
|
||||
cat $TMP_FILE >$LETSENCRYPT_OUTPUT
|
||||
@@ -110,7 +110,7 @@ LETSENCRYPT_FILE=$(find /etc/ssl/keys/ -type f -name letsencrypt)
|
||||
if [ "$DOMAIN" != "localhost" ]; then
|
||||
if [ ! -f $LETSENCRYPT_OUTPUT ]; then
|
||||
install -m 664 -g 65534 /dev/null $LETSENCRYPT_OUTPUT
|
||||
echo '[]' >$LETSENCRYPT_OUTPUT
|
||||
echo '{}' >$LETSENCRYPT_OUTPUT
|
||||
fi
|
||||
|
||||
if [ "$DOMAIN" != "" ]; then
|
||||
|
Reference in New Issue
Block a user