From b7fbd9aea0ea5c140cfe1149b6a83b39c88ed584 Mon Sep 17 00:00:00 2001 From: Justin Clark Date: Fri, 6 Nov 2015 16:47:19 -0800 Subject: [PATCH] Fix dokku certs:add file input bug - fixes issue #1658 - add better output for argument files missing - don't delete (move) the certs passed in --- plugins/certs/commands | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/plugins/certs/commands b/plugins/certs/commands index 870cd48cfd9..226343052f7 100755 --- a/plugins/certs/commands +++ b/plugins/certs/commands @@ -11,11 +11,17 @@ is_tar_import() { } is_file_import() { - local CRT_FILE="$3" - local KEY_FILE="$4" - - if [[ -f $CRT_FILE ]] && [[ -f $KEY_FILE ]]; then - return 0 + local CRT_FILE="$1" + local KEY_FILE="$2" + + if [[ $CRT_FILE ]] && [[ $KEY_FILE ]]; then + if [[ ! -f $CRT_FILE ]]; then + dokku_log_fail "CRT file specified not found, please check file paths" + elif [[ ! -f $KEY_FILE ]]; then + dokku_log_fail "KEY file specified not found, please check file paths" + else + return 0 + fi fi return 1 @@ -55,8 +61,8 @@ certs_set() { fi mkdir -p "$DOKKU_ROOT/$APP/tls" - mv "$CRT_FILE" "$DOKKU_ROOT/$APP/tls/server.crt" - mv "$KEY_FILE" "$DOKKU_ROOT/$APP/tls/server.key" + cp "$CRT_FILE" "$DOKKU_ROOT/$APP/tls/server.crt" + cp "$KEY_FILE" "$DOKKU_ROOT/$APP/tls/server.key" cd $DOKKU_ROOT rm -rf $TEMP_DIR nginx_build_config $APP