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
This commit is contained in:
Justin Clark committed 2015-11-06 16:47:19 -08:00
1 parent 5dbb31cf8a
commit b7fbd9aea0
1 file changed
+11 -5
+11 -5
View File
@@ -11,12 +11,18 @@ is_tar_import() {
} }
is_file_import() { is_file_import() {
local CRT_FILE="$3" local CRT_FILE="$1"
local KEY_FILE="$4" local KEY_FILE="$2"
if [[ -f $CRT_FILE ]] && [[ -f $KEY_FILE ]]; then 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 return 0
fi fi
fi
return 1 return 1
} }
@@ -55,8 +61,8 @@ certs_set() {
fi fi
mkdir -p "$DOKKU_ROOT/$APP/tls" mkdir -p "$DOKKU_ROOT/$APP/tls"
mv "$CRT_FILE" "$DOKKU_ROOT/$APP/tls/server.crt" cp "$CRT_FILE" "$DOKKU_ROOT/$APP/tls/server.crt"
mv "$KEY_FILE" "$DOKKU_ROOT/$APP/tls/server.key" cp "$KEY_FILE" "$DOKKU_ROOT/$APP/tls/server.key"
cd $DOKKU_ROOT cd $DOKKU_ROOT
rm -rf $TEMP_DIR rm -rf $TEMP_DIR
nginx_build_config $APP nginx_build_config $APP