From 1200f393efd1fbf4ada84e292800f5005b677bbb Mon Sep 17 00:00:00 2001 From: Luke Murphy Date: Tue, 29 Dec 2020 17:57:25 +0100 Subject: [PATCH] Use set -a/+a and docker env file formats Closes https://git.autonomic.zone/coop-cloud/abra/issues/40. --- CHANGELOG.md | 1 + abra | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2436a6a..f97f5b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - `new ` becomes `new ` ([#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)) - 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.0 (2020-12-24) diff --git a/abra b/abra index 1f2447e..aa764e4 100755 --- a/abra +++ b/abra @@ -407,8 +407,11 @@ load_instance() { } load_instance_env() { + set -a # shellcheck disable=SC1090 source "$ENV_FILE" + set +a + if [ -z "$APP" ]; then error "APP not set, maybe $ENV_FILE is using an old format?" fi @@ -513,10 +516,14 @@ sub_app_list (){ FILE="${PARTS[-1]}" SERVER="${PARTS[-2]}" DOMAIN="${FILE%.env}" + # shellcheck disable=SC1090 + set -a APP="$(source "$ENV_FILE" && echo "$APP")" # shellcheck disable=SC1090 APP_STACK_NAME="$(source "$ENV_FILE" && echo "$STACK_NAME")" + set +a + if [ -z "$APP_STACK_NAME" ]; then APP_STACK_NAME="${DOMAIN//./_}" fi @@ -1042,7 +1049,9 @@ abra() { # --env if [ -n "$abra___env" ]; then # shellcheck disable=SC1090 + set -a source "$abra___env" || error "Unable to load env from '$abra___env'" + set +a fi load_custom_commands