feat: allow checking if a service is linked to an app

This commit is contained in:
Jose Diaz-Gonzalez
2018-01-12 01:52:09 -05:00
parent 6775daa8d4
commit 65e2999f31
3 changed files with 39 additions and 0 deletions

View File

@@ -288,6 +288,20 @@ service_info() {
fi
}
service_is_linked() {
declare desc="Links a service to an application"
declare SERVICE="$1" APP="$2"
update_plugin_scheme_for_app "$APP"
local SERVICE_URL=$(service_url "$SERVICE")
local EXISTING_CONFIG=$(config_all "$APP")
local LINK=$(echo "$EXISTING_CONFIG" | grep "$SERVICE_URL" | cut -d: -f1) || true
if [[ -z $LINK ]]; then
dokku_log_warn "Service $SERVICE is not linked to $APP"
exit 1
fi
dokku_log_info1 "Service $SERVICE is linked to $APP"
}
service_link() {
declare desc="Links a service to an application"
declare SERVICE="$1" APP="$2"