Alert on missing secrets, re-add . → _ STACK_NAME
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
3wc
2021-01-09 15:07:39 +02:00
parent 1c7a51bce1
commit 8a08de51e4
2 changed files with 13 additions and 3 deletions

14
abra
View File

@ -425,7 +425,7 @@ load_instance() {
fi
IFS='/' read -r -a PARTS <<< "$ENV_FILE"
SERVER="${PARTS[-2]}"
export STACK_NAME="$APP"
export STACK_NAME="${APP//./_}"
}
load_instance_env() {
@ -507,6 +507,10 @@ stack_logs (){
auto_gen_secrets (){
get_app_secrets
if [ "${#PASSWORDS[@]}" -eq 0 ]; then
error "No secrets found in $ENV_FILE"
fi
for PASSWORD in "${PASSWORDS[@]}"; do
parse_secret "$PASSWORD"
done
@ -680,7 +684,10 @@ sub_app_new (){
get_app_secrets
if [ "${#PASSWORDS[@]}" -gt 0 ] && [ "$abra___secrets" == "true" ]; then
if [ "$abra___secrets" == "true" ]; then
if [ "${#PASSWORDS[@]}" -eq 0 ]; then
warning "--secrets provided but no secrets found"
fi
auto_gen_secrets
fi
@ -1019,6 +1026,7 @@ sub_app_secret_generate(){
abra___all="false"
auto_gen_secrets
return
fi
if [[ -n "$LENGTH" ]]; then
@ -1029,6 +1037,8 @@ sub_app_secret_generate(){
PWGEN="${abra__cmd_:-pwqgen}"
fi
echo "SECRET: $SECRET, VERSION $VERSION, PW $PW, ALL $abra___all"
if [ -z "$SECRET" ] || [ -z "$VERSION" ] && [ "$abra___all" == "false" ]; then
error "Required arguments missing"
fi