Files
dokku/plugins/storage/subcommands/mount
2020-02-10 01:40:30 -05:00

23 lines
833 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)
[[ -z "$APP" || "$MOUNT_PATH" ]] && dokku_log_fail "storage:mount requires an app and a two paths divided by colon."
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 "$@"