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)
|
TMP_FILE=$(mktemp)
|
||||||
jq '
|
jq '
|
||||||
if . == null or . == [] then
|
if . == null or . == [] then
|
||||||
[{"'$DOMAIN'":{"date": "'$DATE'", "status": "'$STATUS'", "log": "'$LOG'"}}]
|
{"'$DOMAIN'":{"date": "'$DATE'", "status": "'$STATUS'", "log": "'$LOG'"}}
|
||||||
else
|
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
|
end
|
||||||
' $LETSENCRYPT_OUTPUT >$TMP_FILE
|
' $LETSENCRYPT_OUTPUT >$TMP_FILE
|
||||||
cat $TMP_FILE >$LETSENCRYPT_OUTPUT
|
cat $TMP_FILE >$LETSENCRYPT_OUTPUT
|
||||||
@@ -110,7 +110,7 @@ LETSENCRYPT_FILE=$(find /etc/ssl/keys/ -type f -name letsencrypt)
|
|||||||
if [ "$DOMAIN" != "localhost" ]; then
|
if [ "$DOMAIN" != "localhost" ]; then
|
||||||
if [ ! -f $LETSENCRYPT_OUTPUT ]; then
|
if [ ! -f $LETSENCRYPT_OUTPUT ]; then
|
||||||
install -m 664 -g 65534 /dev/null $LETSENCRYPT_OUTPUT
|
install -m 664 -g 65534 /dev/null $LETSENCRYPT_OUTPUT
|
||||||
echo '[]' >$LETSENCRYPT_OUTPUT
|
echo '{}' >$LETSENCRYPT_OUTPUT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$DOMAIN" != "" ]; then
|
if [ "$DOMAIN" != "" ]; then
|
||||||
|
Reference in New Issue
Block a user