feat: implement exists and linked subcommands

This commit is contained in:
Jose Diaz-Gonzalez
2018-02-25 15:42:27 -05:00
parent f17c3181b7
commit 3f257c4aca
4 changed files with 60 additions and 0 deletions

View File

@@ -289,6 +289,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"