这是indexloc提供的服务,不要输入任何密码
Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 19 additions & 9 deletions plugins/domains/commands
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ case "$1" in
verify_app_name "$2"
APP="$2"

if [[ -z $3 ]]; then
echo "Usage: dokku $1 $APP DOMAIN"
if [[ -z "${*:3}" ]]; then
echo "Usage: dokku $1 $APP DOMAIN [DOMAIN ...]"
echo "Must specify DOMAIN."
exit 1
fi
Expand All @@ -82,12 +82,17 @@ case "$1" in
exit 1
fi

shift 2
dokku domains:setup $APP
echo "$3" >> "$DOKKU_ROOT/$APP/VHOST"
for DOMAIN in "$@";do
echo "$DOMAIN" >> "$DOKKU_ROOT/$APP/VHOST"
done
# we need to restart the app to make sure we're binding to the appropriate network interface
dokku ps:restart $APP
dokku nginx:build-config $APP
pluginhook post-domains-update $APP
dokku_log_info1 "Added $3 to $APP"
for DOMAIN in "$@";do
dokku_log_info1 "Added $DOMAIN to $APP"
done

;;

Expand All @@ -108,16 +113,21 @@ case "$1" in
verify_app_name "$2"
APP="$2"

if [[ -z $3 ]]; then
echo "Usage: dokku $1 $2 DOMAIN"
if [[ -z "${*:3}" ]]; then
echo "Usage: dokku $1 $APP DOMAIN [DOMAIN ...]"
echo "Must specify DOMAIN."
exit 1
fi

shift 2
dokku domains:setup $APP
sed -i "/^$3$/d" "$DOKKU_ROOT/$APP/VHOST"
for DOMAIN in "$@";do
sed -i "/^$DOMAIN$/d" "$DOKKU_ROOT/$APP/VHOST"
done
pluginhook post-domains-update $APP
dokku_log_info1 "Removed $3 from $APP"
for DOMAIN in "$@";do
dokku_log_info1 "Removed $DOMAIN from $APP"
done

;;

Expand Down
7 changes: 6 additions & 1 deletion tests/unit/core_ports.bats
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,12 @@ teardown() {
echo "status: "$status
assert_success

CONTAINER_ID=$(docker ps --no-trunc| grep dokku/$TEST_APP | grep "start web" | awk '{ print $1 }')
run dokku ps:restart $TEST_APP
echo "output: "$output
echo "status: "$status
assert_success

CONTAINER_ID=$(docker ps --no-trunc| grep dokku/$TEST_APP | grep "start web" | awk '{ print $1 }' | head -1)
run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep '[0-9]*'"
echo "output: "$output
echo "status: "$status
Expand Down
7 changes: 7 additions & 0 deletions tests/unit/domains.bats
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ teardown() {
assert_success
}

@test "(domains) domains:add (multiple)" {
run dokku domains:add $TEST_APP www.test.app.dokku.me test.app.dokku.me
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this tests multiple domains....

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats gotta be new. Or I can't read...

echo "output: "$output
echo "status: "$status
assert_success
}

@test "(domains) domains:remove" {
run dokku domains:add $TEST_APP test.app.dokku.me
echo "output: "$output
Expand Down