Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow named volume mounts in regex #4311

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion plugins/storage/functions
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ source "$PLUGIN_AVAILABLE_PATH/docker-options/functions"

verify_paths() {
declare desc="verifies storage paths"
echo "$1" | grep -qe '^/.*\:/' || dokku_log_fail "Storage path must be two valid paths divided by colon."
local -r passed_path=$1
if [[ "$passed_path" = /* ]]; then
echo "$passed_path" | grep -qe '^/.*\:/' || dokku_log_fail "Storage path must be two valid paths divided by colon."
else
echo "$passed_path" | grep -qe '^[a-zA-Z0-9]\{1\}[a-zA-Z0-9_.-]\+\:\/' || dokku_log_fail "Volume name must be two characters or more. Volume name must not contain invalid characters. Storage path must be two valid paths divided by colon."
fi

}

check_if_path_exists() {
Expand Down
4 changes: 4 additions & 0 deletions tests/unit/storage.bats
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,8 @@ teardown() {
echo "status: $status"
assert_output " ! Mount path does not exist."
assert_failure
run /bin/bash -c "dokku storage:mount $TEST_APP mount_volume:/mount"
echo "output: $output"
echo "status: $status"
assert_success
}