From b3fea6b0bb0ca08ccc16a925c91eb6cdc1ef46e5 Mon Sep 17 00:00:00 2001 From: Radon Rosborough Date: Tue, 6 Jul 2021 03:23:06 +0000 Subject: [PATCH] Don't fail when .env is missing --- bin/dep | 8 +++++--- bin/docker | 8 +++++--- bin/packer | 8 +++++--- bin/skopeo | 8 +++++--- bin/terraform | 8 +++++--- 5 files changed, 25 insertions(+), 15 deletions(-) diff --git a/bin/dep b/bin/dep index b500f8d..29d96c1 100755 --- a/bin/dep +++ b/bin/dep @@ -4,8 +4,10 @@ set -euo pipefail root="$(cd "$(dirname "$0")/.." && echo "${PWD}")" -set -a -. "${root}/.env" -set +a +if [[ -f "${root}.env" ]]; then + set -a + . "${root}/.env" + set +a +fi exec node "${root}/tools/depgraph.js" "$@" diff --git a/bin/docker b/bin/docker index cc95d60..7f6d25f 100755 --- a/bin/docker +++ b/bin/docker @@ -6,9 +6,11 @@ root="$(cd "$(dirname "$0")/.." && echo "${PWD}")" export PATH="$(sed -E "s_:${root}/bin:_:_; s_(^|:)${root}/bin(:|$)__" <<< "${PATH}")" -set -a -. "${root}/.env" -set +a +if [[ -f "${root}.env" ]]; then + set -a + . "${root}/.env" + set +a +fi if [[ "${OSTYPE:-}" != darwin* ]] && [[ "${EUID}" != 0 ]]; then exec sudo -E docker "$@" diff --git a/bin/packer b/bin/packer index 8371d78..5f1e9ad 100755 --- a/bin/packer +++ b/bin/packer @@ -6,9 +6,11 @@ root="$(cd "$(dirname "$0")/.." && echo "${PWD}")" export PATH="$(sed -E "s_:${root}/bin:_:_; s_(^|:)${root}/bin(:|$)__" <<< "${PATH}")" -set -a -. "${root}/.env" -set +a +if [[ -f "${root}.env" ]]; then + set -a + . "${root}/.env" + set +a +fi cd "${root}/packer" diff --git a/bin/skopeo b/bin/skopeo index b88d16d..e8ebcda 100755 --- a/bin/skopeo +++ b/bin/skopeo @@ -6,9 +6,11 @@ root="$(cd "$(dirname "$0")/.." && echo "${PWD}")" export PATH="$(sed -E "s_:${root}/bin:_:_; s_(^|:)${root}/bin(:|$)__" <<< "${PATH}")" -set -a -. "${root}/.env" -set +a +if [[ -f "${root}.env" ]]; then + set -a + . "${root}/.env" + set +a +fi if [[ "${OSTYPE:-}" != darwin* ]] && [[ "${EUID}" != 0 ]]; then exec sudo -E skopeo "$@" diff --git a/bin/terraform b/bin/terraform index b4cf3b2..0cfb233 100755 --- a/bin/terraform +++ b/bin/terraform @@ -6,9 +6,11 @@ root="$(cd "$(dirname "$0")/.." && echo "${PWD}")" export PATH="$(sed -E "s_:${root}/bin:_:_; s_(^|:)${root}/bin(:|$)__" <<< "${PATH}")" -set -a -. "${root}/.env" -set +a +if [[ -f "${root}.env" ]]; then + set -a + . "${root}/.env" + set +a +fi cd "${root}/tf"