diff --git a/common-functions b/common-functions index d325166..08a6c6f 100755 --- a/common-functions +++ b/common-functions @@ -586,6 +586,26 @@ service_parse_args() { shift "$((OPTIND - 1))" # remove options from positional parameters } +service_password() { + declare desc="Fetch the password for a service" + declare SERVICE="$1" + local SERVICE_ROOT="$PLUGIN_DATA_ROOT/$SERVICE" + local PASSWORD_FILE="$SERVICE_ROOT/PASSWORD" + if [[ -f "$PASSWORD" ]]; then + cat "$PASSWORD_FILE" + fi +} + +service_root_password() { + declare desc="Fetch the root password for a service" + declare SERVICE="$1" + local SERVICE_ROOT="$PLUGIN_DATA_ROOT/$SERVICE" + local PASSWORD_FILE="$SERVICE_ROOT/ROOTPASSWORD" + if [[ -f "$PASSWORD" ]]; then + cat "$PASSWORD_FILE" + fi +} + service_port_expose() { declare desc="Wrapper for exposing service ports" declare SERVICE="$1" diff --git a/functions b/functions index 5050ee8..2e9bc1a 100755 --- a/functions +++ b/functions @@ -142,13 +142,6 @@ service_start() { fi } -service_password() { - local SERVICE="$1" - local SERVICE_ROOT="$PLUGIN_DATA_ROOT/$SERVICE" - local PASSWORD="$(cat "$SERVICE_ROOT/PASSWORD")" - echo "$PASSWORD" -} - service_url() { local SERVICE="$1" local PASSWORD="$(service_password "$SERVICE")"