feat: allow checking if a service exists
This commit is contained in:
@@ -29,6 +29,7 @@ mysql:connect <name> Connect via mysql to a mysql service
|
||||
mysql:create <name> Create a mysql service with environment variables
|
||||
mysql:destroy <name> Delete the service, delete the data and stop its container if there are no links left
|
||||
mysql:enter <name> [command] Enter or run a command in a running mysql service container
|
||||
mysql:exists <service> Check if the MySQL service exists
|
||||
mysql:export <name> > <file> Export a dump of the mysql service database
|
||||
mysql:expose <name> [port] Expose a mysql service on custom port if provided (random port otherwise)
|
||||
mysql:import <name> < <file> Import a dump into the mysql service database
|
||||
|
||||
20
subcommands/exists
Executable file
20
subcommands/exists
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/config"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_BASE_PATH/common/functions"
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/functions"
|
||||
|
||||
service-exists-cmd() {
|
||||
#E here we check if the lolipop $PLUGIN_COMMAND_PREFIX service exists.
|
||||
#E dokku $PLUGIN_COMMAND_PREFIX:exists lolipop
|
||||
#A service, service to run command against
|
||||
declare desc="check if the $PLUGIN_SERVICE service exists"
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:exists" argv=("$@"); [[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
declare SERVICE="$1"
|
||||
|
||||
[[ -z "$SERVICE" ]] && dokku_log_fail "Please specify a name for the service"
|
||||
verify_service_name "$SERVICE"
|
||||
dokku_log_info1 "Service $SERVICE exists"
|
||||
}
|
||||
|
||||
service-exists-cmd "$@"
|
||||
Reference in New Issue
Block a user