Read REDIS_DATABASE_SCHEME variable from app when setting REDIS_URL

This commit is contained in:
Jose Diaz-Gonzalez
2016-04-19 12:09:24 -04:00
parent 82ed92bb6e
commit 5bcaf4fec5
4 changed files with 52 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$(dirname "$0")/config"
source "$PLUGIN_AVAILABLE_PATH/config/functions"
get_random_ports() {
local iterations="${1:-1}"
@@ -70,6 +71,7 @@ service_exposed_ports() {
service_link() {
local APP="$2"
local SERVICE="$1"
update_plugin_scheme_for_app "$APP"
local SERVICE_URL=$(service_url "$SERVICE")
local SERVICE_NAME=$(get_service_name "$SERVICE")
local SERVICE_ROOT="$PLUGIN_DATA_ROOT/$SERVICE"
@@ -257,6 +259,7 @@ service_stop() {
service_unlink() {
local APP="$2"
local SERVICE="$1"
update_plugin_scheme_for_app "$APP"
local SERVICE_URL=$(service_url "$SERVICE")
local SERVICE_NAME=$(get_service_name "$SERVICE")
local EXISTING_CONFIG=$(dokku config "$APP")
@@ -310,6 +313,7 @@ promote() {
local APP="$2"
local PLUGIN_DEFAULT_CONFIG_VAR="${PLUGIN_DEFAULT_ALIAS}_URL"
local EXISTING_CONFIG=$(dokku config "$APP")
update_plugin_scheme_for_app "$APP"
local SERVICE_URL=$(service_url "$SERVICE")
local CONFIG_VARS=($(echo "$EXISTING_CONFIG" | grep "$SERVICE_URL" | cut -d: -f1)) || true
local PREVIOUS_DEFAULT_URL=$(get_url_from_config "$EXISTING_CONFIG" "$PLUGIN_DEFAULT_CONFIG_VAR")
@@ -351,3 +355,9 @@ service_linked_apps() {
tr '\n' ' ' < "$LINKS_FILE"
}
update_plugin_scheme_for_app() {
local APP=$1
local REDIS_DATABASE_SCHEME=$(config_get $APP REDIS_DATABASE_SCHEME)
PLUGIN_SCHEME=${REDIS_DATABASE_SCHEME:-$PLUGIN_SCHEME}
}