Files
dokku-postgres/service-list
Jose Diaz-Gonzalez 4e3a77ab0e feat: add method for listing all plugin services
This will allow other plugins to iterate over the services exposed by a plugin and instantiate whatever is necessary for those services.
2022-07-25 01:30:32 -04:00

21 lines
561 B
Bash
Executable File

#!/usr/bin/env bash
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/config"
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common-functions"
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
plugin-service-list() {
declare desc="allows listing all services for use by other dokku plugins"
declare SERVICE_TYPE="$1"
if [[ -n "$SERVICE_TYPE" ]] && [[ "$SERVICE_TYPE" != "$PLUGIN_COMMAND_PREFIX" ]]; then
return
fi
for service in $(fn-services-list false); do
echo "$PLUGIN_COMMAND_PREFIX:$service"
done
}
plugin-service-list "$@"