Use ABRA_DIR instead of hard-coding .abra

This commit is contained in:
3wc 2020-11-18 00:34:38 +02:00
parent 946a527baa
commit c57069e0af
1 changed files with 6 additions and 4 deletions

10
abra
View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash
GIT_URL="https://git.autonomic.zone/coop-cloud/"
ABRA_DIR="$HOME/.abra"
ABRA_DIR="${ABRA_DIR:-$HOME/.abra}"
#######################################
# Global help
@ -348,7 +348,8 @@ load_custom_commands() {
get_servers() {
shopt -s nullglob dotglob
SERVERS=(~/.abra/servers/*)
# shellcheck disable=SC2206
SERVERS=($ABRA_DIR/servers/*)
shopt -u nullglob dotglob
}
@ -370,7 +371,7 @@ get_app_keys() {
load_instance() {
DOMAIN="$abra__domain_"
# FIXME 3wc: requires bash 4, use for loop instead
mapfile -t ENV_FILES < <(find -L ~/.abra -name "$DOMAIN.env")
mapfile -t ENV_FILES < <(find -L "$ABRA_DIR" -name "$DOMAIN.env")
case "${#ENV_FILES[@]}" in
1 ) ;;
0 ) error "Can't find app '$DOMAIN'"; return;;
@ -446,7 +447,8 @@ sub_app_ls (){
sub_app_list (){
shopt -s nullglob dotglob
ENV_FILES=(~/.abra/servers/*/*.env)
# shellcheck disable=SC2206
ENV_FILES=($ABRA_DIR/servers/*/*.env)
shopt -u nullglob dotglob
STATUS="${abra___status:+STATUS}"