#!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" ansible_add_vault_password_cmd() { #shellcheck disable=SC2034 declare desc="insert new vault password for encrypt/decrypt of passwords" if [[ -f "$DOKKU_LIB/data/ansible/.vault-password" ]]; then dokku_col_log_info1_quiet "Vault password already in place" exit 0 fi read -srp "Vault password", vault_password if [[ -d "$DOKKU_LIB/data/ansible" ]]; then dokku_col_log_info1_quiet "Creating $DOKKU_LIB/data/ansible" mkdir -p "$DOKKU_LIB/data/ansible" fi dokku_col_log_info1_quiet "Generating $DOKKU_LIB/data/ansible/.vault-password" echo "$vault_password" > "$DOKKU_LIB/data/ansible/.vault-password" } ansible_add_vault_password_cmd "$@"