Files
dokku/plugins/storage/subcommands/mount
Jose Diaz-Gonzalez fd162f8895 feat: add verify_app_name calls to all shell subcommands
Without this, folks could potentially run commands against invalid applications.
2020-12-27 15:14:11 -05:00

22 lines
714 B
Bash
Executable File

#!/usr/bin/env bash
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/storage/functions"
source "$PLUGIN_AVAILABLE_PATH/docker-options/functions"
cmd-storage-mount() {
declare desc="Add bind-mount, redeploy app if running"
declare cmd="storage:mount"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" MOUNT_PATH="$2"
local passed_phases=(deploy run)
verify_app_name "$APP"
verify_paths "$MOUNT_PATH"
check_if_path_exists "$MOUNT_PATH" "$(get_phase_file_path "${passed_phases[@]}")" && dokku_log_fail "Mount path already exists."
add_passed_docker_option passed_phases[@] "-v $MOUNT_PATH"
}
cmd-storage-mount "$@"