chore: move to helper functions for fetching passwords

This commit is contained in:
Jose Diaz-Gonzalez
2019-07-11 16:34:35 -07:00
parent ba5b90349b
commit 86e7d53749
2 changed files with 20 additions and 7 deletions

View File

@@ -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"