feat: implement link querystring flags. Refs dokku/dokku-redis#64
This commit is contained in:
@@ -370,6 +370,7 @@ service_link() {
|
|||||||
else
|
else
|
||||||
dokku docker-options:add "$APP" build,deploy,run "--link $SERVICE_NAME:$SERVICE_ALIAS"
|
dokku docker-options:add "$APP" build,deploy,run "--link $SERVICE_NAME:$SERVICE_ALIAS"
|
||||||
fi
|
fi
|
||||||
|
[[ -n "$SERVICE_QUERYSTRING" ]] && SERVICE_URL="${SERVICE_URL}?${SERVICE_QUERYSTRING}"
|
||||||
config_set "$APP" "${ALIAS}_URL=$SERVICE_URL"
|
config_set "$APP" "${ALIAS}_URL=$SERVICE_URL"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -460,7 +461,7 @@ service_parse_args() {
|
|||||||
;;
|
;;
|
||||||
p) export SERVICE_PASSWORD=$OPTARG
|
p) export SERVICE_PASSWORD=$OPTARG
|
||||||
;;
|
;;
|
||||||
q) export SERVICE_QUERYSTRING=$OPTARG
|
q) export SERVICE_QUERYSTRING=${OPTARG#"?"}
|
||||||
;;
|
;;
|
||||||
r) export SERVICE_ROOT_PASSWORD=$OPTARG
|
r) export SERVICE_ROOT_PASSWORD=$OPTARG
|
||||||
;;
|
;;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ service-clone-cmd() {
|
|||||||
#F -r|--root-password PASSWORD, override the root-level service password
|
#F -r|--root-password PASSWORD, override the root-level service password
|
||||||
declare desc="create container <new-name> then copy data from <name> into <new-name>"
|
declare desc="create container <new-name> then copy data from <name> into <new-name>"
|
||||||
local cmd="$PLUGIN_COMMAND_PREFIX:clone" argv=("$@"); [[ ${argv[0]} == "$cmd" ]] && shift 1
|
local cmd="$PLUGIN_COMMAND_PREFIX:clone" argv=("$@"); [[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||||
declare SERVICE="$1" NEW_SERVICE="$2"
|
declare SERVICE="$1" NEW_SERVICE="$2" CLONE_FLAGS_LIST="${@:3}"
|
||||||
is_implemented_command "$cmd" || dokku_log_fail "Not yet implemented"
|
is_implemented_command "$cmd" || dokku_log_fail "Not yet implemented"
|
||||||
|
|
||||||
[[ -z "$SERVICE" ]] && dokku_log_fail "Please specify a name for the service"
|
[[ -z "$SERVICE" ]] && dokku_log_fail "Please specify a name for the service"
|
||||||
|
|||||||
@@ -41,13 +41,15 @@ service-link-cmd() {
|
|||||||
#A app, app to run command against
|
#A app, app to run command against
|
||||||
declare desc="link the $PLUGIN_SERVICE service to the app"
|
declare desc="link the $PLUGIN_SERVICE service to the app"
|
||||||
local cmd="$PLUGIN_COMMAND_PREFIX:link" argv=("$@"); [[ ${argv[0]} == "$cmd" ]] && shift 1
|
local cmd="$PLUGIN_COMMAND_PREFIX:link" argv=("$@"); [[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||||
declare SERVICE="$1" APP="$2"
|
declare SERVICE="$1" APP="$2" LINK_FLAGS_LIST="${@:3}"
|
||||||
APP=${APP:="$DOKKU_APP_NAME"}
|
APP=${APP:="$DOKKU_APP_NAME"}
|
||||||
|
|
||||||
[[ -z "$SERVICE" ]] && dokku_log_fail "Please specify a name for the service"
|
[[ -z "$SERVICE" ]] && dokku_log_fail "Please specify a name for the service"
|
||||||
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
|
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||||
verify_app_name "$APP"
|
verify_app_name "$APP"
|
||||||
verify_service_name "$SERVICE"
|
verify_service_name "$SERVICE"
|
||||||
|
|
||||||
|
service_parse_args "${@:3}"
|
||||||
service_link "$SERVICE" "$APP"
|
service_link "$SERVICE" "$APP"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -68,3 +68,10 @@ teardown() {
|
|||||||
assert_contains "$url" "postgres2://postgres:$password@dokku-postgres-l:5432/l"
|
assert_contains "$url" "postgres2://postgres:$password@dokku-postgres-l:5432/l"
|
||||||
dokku "$PLUGIN_COMMAND_PREFIX:unlink" l my_app
|
dokku "$PLUGIN_COMMAND_PREFIX:unlink" l my_app
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "($PLUGIN_COMMAND_PREFIX:link) adds a querystring" {
|
||||||
|
dokku "$PLUGIN_COMMAND_PREFIX:link" l my_app --querystring "pool=5"
|
||||||
|
url=$(dokku config:get my_app DATABASE_URL)
|
||||||
|
assert_contains "$url" "?pool=4"
|
||||||
|
dokku "$PLUGIN_COMMAND_PREFIX:unlink" l my_app
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user