From c9e4131267db44181330c0a02320bd9da2f6369e Mon Sep 17 00:00:00 2001 From: Jeff Ching Date: Mon, 4 Nov 2024 10:02:40 -0800 Subject: [PATCH] feat: load additional .trampolinerc file next to trampoline_v2.sh file if present (#57) --- trampoline_v2.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/trampoline_v2.sh b/trampoline_v2.sh index a05a2f0..a566674 100755 --- a/trampoline_v2.sh +++ b/trampoline_v2.sh @@ -56,6 +56,7 @@ set -euo pipefail # x-release-please-start-version TRAMPOLINE_VERSION="2.0.11" # x-release-please-end +CURRENT_DIR=$(dirname "${BASH_SOURCE[0]}") if command -v tput >/dev/null && [[ -n "${TERM:-}" ]]; then readonly IO_COLOR_RED="$(tput setaf 1)" @@ -281,10 +282,16 @@ required_envvars=( "TRAMPOLINE_BUILD_FILE" ) +# Load additional trampoline configuration from PROJECT_ROOT if [[ -f "${PROJECT_ROOT}/.trampolinerc" ]]; then source "${PROJECT_ROOT}/.trampolinerc" fi +# Load additional trampoline configuration from shared directory +if [[ "${CURRENT_DIR}" != "${PROJECT_ROOT}" && -f "${CURRENT_DIR}/.trampolinerc" ]]; then + source "${CURRENT_DIR}/.trampolinerc" +fi + log_yellow "Checking environment variables." for e in "${required_envvars[@]}" do