Merge pull request 'Use set -a/+a and docker env file formats' (#55) from use-set-a into main
Reviewed-on: coop-cloud/abra#55
This commit is contained in:
commit
678906cb39
@ -5,6 +5,7 @@
|
|||||||
- `new <app>` becomes `new <type>` ([#48](https://git.autonomic.zone/coop-cloud/abra/issues/48))
|
- `new <app>` becomes `new <type>` ([#48](https://git.autonomic.zone/coop-cloud/abra/issues/48))
|
||||||
- `check` is run on `deploy` now and configurable ([77ba5652b2fe15820f5edfa0f642636f7b8eae7e](https://git.autonomic.zone/coop-cloud/abra/commit/77ba5652b2fe15820f5edfa0f642636f7b8eae7e))
|
- `check` is run on `deploy` now and configurable ([77ba5652b2fe15820f5edfa0f642636f7b8eae7e](https://git.autonomic.zone/coop-cloud/abra/commit/77ba5652b2fe15820f5edfa0f642636f7b8eae7e))
|
||||||
- App configurations are always updated now ([#42](https://git.autonomic.zone/coop-cloud/abra/issues/42))
|
- App configurations are always updated now ([#42](https://git.autonomic.zone/coop-cloud/abra/issues/42))
|
||||||
|
- We use docker format `.env` files (no "export" syntax) from now now ([#55](https://git.autonomic.zone/coop-cloud/abra/pulls/55))
|
||||||
|
|
||||||
# abra 0.4.1 (2020-12-24)
|
# abra 0.4.1 (2020-12-24)
|
||||||
|
|
||||||
|
17
abra
17
abra
@ -336,7 +336,7 @@ require_app_latest() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# FIXME 3wc: update or remove
|
# FIXME 3wc: update or remove
|
||||||
if [ -z "$ABRA_ENV" ] && [ -f .envrc ] && type direnv > /dev/null 2>&1 && ! direnv status | grep -q 'Found RC allowed true'; then
|
if [ -z "$ABRA_ENV" ] && [ -f .env ] && type direnv > /dev/null 2>&1 && ! direnv status | grep -q 'Found RC allowed true'; then
|
||||||
error "direnv is blocked, run direnv allow"
|
error "direnv is blocked, run direnv allow"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -403,8 +403,11 @@ load_instance() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
load_instance_env() {
|
load_instance_env() {
|
||||||
|
set -a
|
||||||
# shellcheck disable=SC1090
|
# shellcheck disable=SC1090
|
||||||
source "$ENV_FILE"
|
source "$ENV_FILE"
|
||||||
|
set +a
|
||||||
|
|
||||||
if [ -z "$APP" ]; then
|
if [ -z "$APP" ]; then
|
||||||
error "APP not set, maybe $ENV_FILE is using an old format?"
|
error "APP not set, maybe $ENV_FILE is using an old format?"
|
||||||
fi
|
fi
|
||||||
@ -525,10 +528,14 @@ sub_app_list (){
|
|||||||
FILE="${PARTS[-1]}"
|
FILE="${PARTS[-1]}"
|
||||||
SERVER="${PARTS[-2]}"
|
SERVER="${PARTS[-2]}"
|
||||||
DOMAIN="${FILE%.env}"
|
DOMAIN="${FILE%.env}"
|
||||||
|
|
||||||
|
set -a
|
||||||
# shellcheck disable=SC1090
|
# shellcheck disable=SC1090
|
||||||
APP="$(source "$ENV_FILE" && echo "$APP")"
|
APP="$(source "$ENV_FILE" && echo "$APP")"
|
||||||
# shellcheck disable=SC1090
|
# shellcheck disable=SC1090
|
||||||
APP_STACK_NAME="$(source "$ENV_FILE" && echo "$STACK_NAME")"
|
APP_STACK_NAME="$(source "$ENV_FILE" && echo "$STACK_NAME")"
|
||||||
|
set +a
|
||||||
|
|
||||||
if [ -z "$APP_STACK_NAME" ]; then
|
if [ -z "$APP_STACK_NAME" ]; then
|
||||||
APP_STACK_NAME="${DOMAIN//./_}"
|
APP_STACK_NAME="${DOMAIN//./_}"
|
||||||
fi
|
fi
|
||||||
@ -585,7 +592,7 @@ sub_app_new (){
|
|||||||
# FIXME 3wc: offer to user $STACK_$DOMAIN.env name instead
|
# FIXME 3wc: offer to user $STACK_$DOMAIN.env name instead
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cp "$APP_DIR/.envrc.sample" "$ENV_FILE"
|
cp "$APP_DIR/.env.sample" "$ENV_FILE"
|
||||||
sed -i "s/$APP\.example\.com/$DOMAIN/g" "$ENV_FILE"
|
sed -i "s/$APP\.example\.com/$DOMAIN/g" "$ENV_FILE"
|
||||||
sed -i "s/example\.com/$DOMAIN/g" "$ENV_FILE"
|
sed -i "s/example\.com/$DOMAIN/g" "$ENV_FILE"
|
||||||
|
|
||||||
@ -676,8 +683,8 @@ sub_app_check (){
|
|||||||
|
|
||||||
#APP_ENV=$(grep -v '^#' "$ENV_FILE" | sed 's/^.* \([^=]\+\)=.*/\1/' | sort)
|
#APP_ENV=$(grep -v '^#' "$ENV_FILE" | sed 's/^.* \([^=]\+\)=.*/\1/' | sort)
|
||||||
APP_ENV=$(grep -v '^#' "$ENV_FILE" | cut -d' ' -f2 | cut -d'=' -f1 | sort)
|
APP_ENV=$(grep -v '^#' "$ENV_FILE" | cut -d' ' -f2 | cut -d'=' -f1 | sort)
|
||||||
#STACK_ENV=$(grep -v '^#' "$APP_DIR/.envrc.sample" | sed 's/^.* \([^=]\+\)=.*/\1/' | sort)
|
#STACK_ENV=$(grep -v '^#' "$APP_DIR/.env.sample" | sed 's/^.* \([^=]\+\)=.*/\1/' | sort)
|
||||||
STACK_ENV=$(grep -v '^#' "$APP_DIR/.envrc.sample" | cut -d' ' -f2 | cut -d'=' -f1 | sort)
|
STACK_ENV=$(grep -v '^#' "$APP_DIR/.env.sample" | cut -d' ' -f2 | cut -d'=' -f1 | sort)
|
||||||
|
|
||||||
# Only show "1", items in STACK_ENV which aren't in APP_ENV
|
# Only show "1", items in STACK_ENV which aren't in APP_ENV
|
||||||
MISSING_VARS=$(comm -23 <(echo "$STACK_ENV") <(echo "$APP_ENV"))
|
MISSING_VARS=$(comm -23 <(echo "$STACK_ENV") <(echo "$APP_ENV"))
|
||||||
@ -1031,8 +1038,10 @@ abra() {
|
|||||||
|
|
||||||
# --env <env>
|
# --env <env>
|
||||||
if [ -n "$abra___env" ]; then
|
if [ -n "$abra___env" ]; then
|
||||||
|
set -a
|
||||||
# shellcheck disable=SC1090
|
# shellcheck disable=SC1090
|
||||||
source "$abra___env" || error "Unable to load env from '$abra___env'"
|
source "$abra___env" || error "Unable to load env from '$abra___env'"
|
||||||
|
set +a
|
||||||
fi
|
fi
|
||||||
|
|
||||||
load_custom_commands
|
load_custom_commands
|
||||||
|
Loading…
Reference in New Issue
Block a user