-
-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jose Diaz-Gonzalez
committed
Jan 28, 2023
1 parent
c0c18ba
commit bff8244
Showing
3 changed files
with
53 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env bash | ||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/property-functions" | ||
set -eo pipefail | ||
[[ $DOKKU_TRACE ]] && set -x | ||
|
||
trigger-letsencrypt-post-delete() { | ||
declare desc="destroys the letsencrypt properties for a given app" | ||
declare trigger="post-delete" | ||
declare APP="$1" | ||
|
||
fn-plugin-property-destroy "letsencrypt" "$APP" | ||
} | ||
|
||
trigger-letsencrypt-post-delete "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/env bash | ||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" | ||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/property-functions" | ||
set -eo pipefail | ||
[[ $DOKKU_TRACE ]] && set -x | ||
|
||
cmd-letsencrypt-set() { | ||
declare desc="set or clear a letsencrypt property for an app" | ||
declare cmd="letsencrypt:set" | ||
[[ "$1" == "$cmd" ]] && shift 1 | ||
declare APP="$1" KEY="$2" VALUE="$3" | ||
local VALID_KEYS=("email" "graceperiod" "server" "lego-args") | ||
[[ "$APP" == "--global" ]] || verify_app_name "$APP" | ||
|
||
[[ -z "$KEY" ]] && dokku_log_fail "No key specified" | ||
|
||
if ! fn-in-array "$KEY" "${VALID_KEYS[@]}"; then | ||
dokku_log_fail "Invalid key specified, valid keys include: email, graceperiod, server, lego-args" | ||
fi | ||
|
||
if [[ -n "$VALUE" ]]; then | ||
dokku_log_info2_quiet "Setting ${KEY} to ${VALUE}" | ||
fn-plugin-property-write "letsencrypt" "$APP" "$KEY" "$VALUE" | ||
else | ||
dokku_log_info2_quiet "Unsetting ${KEY}" | ||
if [[ "$KEY" == "rev-env-var" ]]; then | ||
fn-plugin-property-write "letsencrypt" "$APP" "$KEY" "$VALUE" | ||
else | ||
fn-plugin-property-delete "letsencrypt" "$APP" "$KEY" | ||
if [[ "$KEY" == "enabled" ]]; then | ||
fn-plugin-property-destroy "letsencrypt" "$APP" | ||
fi | ||
fi | ||
fi | ||
} | ||
|
||
cmd-letsencrypt-set "$@" |