diff --git a/commands b/commands index 0d5006a..2898cdf 100755 --- a/commands +++ b/commands @@ -2,16 +2,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$(dirname "$0")/../common/functions" source "$(dirname "$0")/functions" - -MYSQL_IMAGE=${MYSQL_IMAGE:="mysql"} -MYSQL_IMAGE_VERSION=${MYSQL_IMAGE_VERSION:="5.7"} -MYSQL_ROOT=/var/lib/dokku/services/mysql - -PLUGIN_COMMAND_PREFIX="mysql" -PLUGIN_DATA_ROOT=$MYSQL_ROOT -PLUGIN_SERVICE="MySQL" -PLUGIN_IMAGE=$MYSQL_IMAGE -PLUGIN_IMAGE_VERSION=$MYSQL_IMAGE_VERSION +source "$(dirname "$0")/config" if [[ ! -d $PLUGIN_DATA_ROOT ]]; then dokku_log_fail "$PLUGIN_SERVICE: Please run: sudo dokku plugins-install" diff --git a/dependencies b/dependencies index a0fee97..28cc808 100755 --- a/dependencies +++ b/dependencies @@ -1,5 +1,6 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x +source "$(dirname "$0")/config" case "$DOKKU_DISTRO" in ubuntu) diff --git a/docker-args b/docker-args index 30eedbd..f96362e 100755 --- a/docker-args +++ b/docker-args @@ -2,10 +2,10 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$(dirname "$0")/../common/functions" source "$(dirname "$0")/functions" +source "$(dirname "$0")/config" STDIN=$(cat) APP="$1" -PLUGIN_DATA_ROOT=/var/lib/dokku/services/mysql output="" for i in $PLUGIN_DATA_ROOT/*; do diff --git a/functions b/functions index 55dcc3e..4fcf9b8 100755 --- a/functions +++ b/functions @@ -1,8 +1,6 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x - -PLUGIN_DATA_ROOT=/var/lib/dokku/services/mysql -PLUGIN_SERVICE="MySQL" +source "$(dirname "$0")/config" get_random_port() { local port=$RANDOM @@ -38,7 +36,7 @@ service_alias() { if [[ -f "$ALIAS_FILE" ]]; then cat "$ALIAS_FILE" else - echo "DATABASE" + echo "$PLUGIN_DEFAULT_ALIAS" fi } @@ -50,5 +48,5 @@ service_url() { local ID="$(cat "$SERVICE_ROOT/ID")" local IP="$(get_container_ip "$ID")" local PASSWORD="$(cat "$SERVICE_ROOT/PASSWORD")" - echo "mysql://mysql:$PASSWORD@$IP:3306/$SERVICE" + echo "$PLUGIN_SCHEME://mysql:$PASSWORD@$IP:$PLUGIN_DATASTORE_PORT/$SERVICE" } diff --git a/install b/install index e8c7837..91a71d1 100755 --- a/install +++ b/install @@ -1,14 +1,6 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x - -MYSQL_IMAGE="mysql" -MYSQL_IMAGE_VERSION=5.7 -MYSQL_ROOT=/var/lib/dokku/services/mysql - -PLUGIN_DATA_ROOT=$MYSQL_ROOT -PLUGIN_SERVICE="MySQL" -PLUGIN_IMAGE=$MYSQL_IMAGE -PLUGIN_IMAGE_VERSION=$MYSQL_IMAGE_VERSION +source "$(dirname "$0")/config" if ! docker images | grep -e "^$PLUGIN_IMAGE " | grep -q $PLUGIN_IMAGE_VERSION ; then docker pull $PLUGIN_IMAGE:$PLUGIN_IMAGE_VERSION