diff --git a/README.md b/README.md index e9525cd..e01b5e7 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ dokku redis:link lolipop playground # # and the following will be set on the linked application by default # -# REDIS_URL=redis://dokku-redis-lolipop:6379/0 +# REDIS_URL=redis://dokku-redis-lolipop:6379 # # NOTE: the host exposed here only works internally in docker containers. If # you want your container to be reachable from outside, you should use `expose`. @@ -95,7 +95,7 @@ dokku redis:link other_service playground # since REDIS_URL is already in use, another environment variable will be # generated automatically # -# DOKKU_REDIS_BLUE_URL=redis://dokku-redis-other-service:6379/0 +# DOKKU_REDIS_BLUE_URL=redis://dokku-redis-other-service:6379 # you can then promote the new service to be the primary one # NOTE: this will restart your app @@ -105,8 +105,8 @@ dokku redis:promote other_service playground # another environment variable to hold the previous value if necessary. # you could end up with the following for example: # -# REDIS_URL=redis://dokku-redis-other-service:6379/0 -# DOKKU_REDIS_BLUE_URL=redis://dokku-redis-other-service:6379/0 +# REDIS_URL=redis://dokku-redis-other-service:63790 +# DOKKU_REDIS_BLUE_URL=redis://dokku-redis-other-service:6379 # DOKKU_REDIS_SILVER_URL=redis://dokku-redis-lolipop:6379/lolipop # you can also unlink a redis service diff --git a/functions b/functions index 927d91c..b315d8f 100755 --- a/functions +++ b/functions @@ -295,7 +295,7 @@ service_unlink() { service_url() { local SERVICE="$1" local SERVICE_ALIAS="$(service_alias "$SERVICE")" - echo "$PLUGIN_SCHEME://$SERVICE_ALIAS:${PLUGIN_DATASTORE_PORTS[0]}/0" + echo "$PLUGIN_SCHEME://$SERVICE_ALIAS:${PLUGIN_DATASTORE_PORTS[0]}" } is_container_status () { diff --git a/tests/service_info.bats b/tests/service_info.bats index 5c55e5d..82ad788 100755 --- a/tests/service_info.bats +++ b/tests/service_info.bats @@ -21,12 +21,12 @@ teardown() { @test "($PLUGIN_COMMAND_PREFIX:info) success" { run dokku "$PLUGIN_COMMAND_PREFIX:info" l - assert_contains "${lines[*]}" "DSN: redis://dokku-redis-l:6379/0" + assert_contains "${lines[*]}" "DSN: redis://dokku-redis-l:6379" } @test "($PLUGIN_COMMAND_PREFIX:info) replaces underscores by dash in hostname" { dokku "$PLUGIN_COMMAND_PREFIX:create" test_with_underscores run dokku "$PLUGIN_COMMAND_PREFIX:info" test_with_underscores - assert_contains "${lines[*]}" "DSN: redis://dokku-redis-test-with-underscores:6379/0" + assert_contains "${lines[*]}" "DSN: redis://dokku-redis-test-with-underscores:6379" dokku --force "$PLUGIN_COMMAND_PREFIX:destroy" test_with_underscores } diff --git a/tests/service_link.bats b/tests/service_link.bats index 6b517f7..8081d81 100755 --- a/tests/service_link.bats +++ b/tests/service_link.bats @@ -40,12 +40,12 @@ teardown() { @test "($PLUGIN_COMMAND_PREFIX:link) exports REDIS_URL to app" { dokku "$PLUGIN_COMMAND_PREFIX:link" l my_app url=$(dokku config:get my_app REDIS_URL) - assert_contains "$url" "redis://dokku-redis-l:6379/0" + assert_contains "$url" "redis://dokku-redis-l:6379" dokku "$PLUGIN_COMMAND_PREFIX:unlink" l my_app } @test "($PLUGIN_COMMAND_PREFIX:link) generates an alternate config url when REDIS_URL already in use" { - dokku config:set my_app REDIS_URL=redis://host:6379/0 + dokku config:set my_app REDIS_URL=redis://host:6379 dokku "$PLUGIN_COMMAND_PREFIX:link" l my_app run dokku config my_app assert_contains "${lines[*]}" "DOKKU_REDIS_" @@ -63,6 +63,6 @@ teardown() { dokku config:set my_app REDIS_DATABASE_SCHEME=redis2 dokku "$PLUGIN_COMMAND_PREFIX:link" l my_app url=$(dokku config:get my_app REDIS_URL) - assert_contains "$url" "redis2://dokku-redis-l:6379/0" + assert_contains "$url" "redis2://dokku-redis-l:6379" dokku "$PLUGIN_COMMAND_PREFIX:unlink" l my_app } diff --git a/tests/service_promote.bats b/tests/service_promote.bats index 2eb188e..8e9831c 100755 --- a/tests/service_promote.bats +++ b/tests/service_promote.bats @@ -39,22 +39,22 @@ teardown() { } @test "($PLUGIN_COMMAND_PREFIX:promote) changes REDIS_URL" { - dokku config:set my_app "REDIS_URL=redis://host:6379/db" "DOKKU_REDIS_BLUE_URL=redis://dokku-redis-l:6379/0" + dokku config:set my_app "REDIS_URL=redis://host:6379/db" "DOKKU_REDIS_BLUE_URL=redis://dokku-redis-l:6379" dokku "$PLUGIN_COMMAND_PREFIX:promote" l my_app url=$(dokku config:get my_app REDIS_URL) - assert_equal "$url" "redis://dokku-redis-l:6379/0" + assert_equal "$url" "redis://dokku-redis-l:6379" } @test "($PLUGIN_COMMAND_PREFIX:promote) creates new config url when needed" { - dokku config:set my_app "REDIS_URL=redis://host:6379/db" "DOKKU_REDIS_BLUE_URL=redis://dokku-redis-l:6379/0" + dokku config:set my_app "REDIS_URL=redis://host:6379/db" "DOKKU_REDIS_BLUE_URL=redis://dokku-redis-l:6379" dokku "$PLUGIN_COMMAND_PREFIX:promote" l my_app run dokku config my_app assert_contains "${lines[*]}" "DOKKU_REDIS_" } @test "($PLUGIN_COMMAND_PREFIX:promote) uses REDIS_DATABASE_SCHEME variable" { - dokku config:set my_app "REDIS_DATABASE_SCHEME=redis2" "REDIS_URL=redis://u:p@host:6379" "DOKKU_REDIS_BLUE_URL=redis2://dokku-redis-l:6379/0" + dokku config:set my_app "REDIS_DATABASE_SCHEME=redis2" "REDIS_URL=redis://u:p@host:6379" "DOKKU_REDIS_BLUE_URL=redis2://dokku-redis-l:6379" dokku "$PLUGIN_COMMAND_PREFIX:promote" l my_app url=$(dokku config:get my_app REDIS_URL) - assert_equal "$url" "redis2://dokku-redis-l:6379/0" + assert_equal "$url" "redis2://dokku-redis-l:6379" }