Skip to content

Commit

Permalink
letsencrypt: improve active status check
Browse files Browse the repository at this point in the history
Signed-off-by: nachoparker <[email protected]>
  • Loading branch information
nachoparker committed Sep 20, 2021
1 parent 110311f commit f3e3b01
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bin/ncp/NETWORKING/letsencrypt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ letsencrypt=/usr/bin/letsencrypt

is_active()
{
[[ $( find /etc/letsencrypt/live/ -maxdepth 0 -empty | wc -l ) == 0 ]]
[[ "${ACTIVE}" == "yes" ]] && [[ $( find /etc/letsencrypt/live/ -maxdepth 0 -empty | wc -l ) == 0 ]]
}

tmpl_letsencrypt_domain() {
Expand Down
4 changes: 3 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@

[v1.39.2](https://github.com/nextcloud/nextcloudpi/commit/9598430) (2021-09-18) nextcloud-domain: make sure redis is running before it starts
[v1.39.3](https://github.com/nextcloud/nextcloudpi/commit/295144c) (2021-09-18) letsencrypt: improve active status check

[v1.39.2 ](https://github.com/nextcloud/nextcloudpi/commit/fb5a2f3) (2021-09-18) nextcloud-domain: make sure redis is running before it starts

[v1.39.1 ](https://github.com/nextcloud/nextcloudpi/commit/6290c1f) (2021-09-09) nc-static-IP: take into account httpsonly

Expand Down
15 changes: 14 additions & 1 deletion etc/library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,20 @@ function is_active_app()
# function
unset is_active
source "$script"
[[ $( type -t is_active ) == function ]] && { is_active; return $?; }
[[ $( type -t is_active ) == function ]] && {
# read cfg parameters
[[ -f "$cfg_file" ]] && {
local cfg="$( cat "$cfg_file" )"
local len="$(jq '.params | length' <<<"$cfg")"
for (( i = 0 ; i < len ; i++ )); do
local var="$(jq -r ".params[$i].id" <<<"$cfg")"
local val="$(jq -r ".params[$i].value" <<<"$cfg")"
eval "$var=$val"
done
}
is_active
return $?;
}

# config
[[ -f "$cfg_file" ]] || return 1
Expand Down

0 comments on commit f3e3b01

Please sign in to comment.