Skip to content

Commit 2e57a1c

Browse files
committed
updated .envrc
1 parent 01eac8b commit 2e57a1c

File tree

1 file changed

+24
-7
lines changed

1 file changed

+24
-7
lines changed

.envrc

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,23 +93,40 @@ export COMPOSE_PROJECT_NAME="SQL-scripts"
9393
#export TF_VAR_cloudflare_api_key="$CLOUDFLARE_API_KEY" # must be a key, not a token using the link above
9494

9595
# ============================================================================ #
96-
# Python, AWS, GCP, Terraform
96+
# P y t h o n , A W S , G C P , T e r r a f o r m
9797
# ============================================================================ #
9898

99-
#.envrc-aws \
100-
#.envrc-gcp \
101-
#.envrc-terraform \
102-
for envrc in \
103-
.envrc-python \
104-
; do
99+
load_if_exists(){
100+
local envrc="$1"
105101
if [ -f "$srcdir/$envrc" ]; then
106102
echo
107103
echo "Loading $srcdir/$envrc"
108104
# shellcheck disable=SC1090,SC1091
109105
. "$srcdir/$envrc"
110106
fi
107+
}
108+
109+
#.envrc-aws \
110+
#.envrc-gcp \
111+
#.envrc-terraform \
112+
for envrc in \
113+
.envrc-python \
114+
; do
115+
load_if_exists "$envrc"
111116
done
112117

118+
if [[ "$PWD" =~ /aws/ ]]; then
119+
load_if_exists .envrc-aws
120+
fi
121+
122+
if [[ "$PWD" =~ /gcp/ ]]; then
123+
load_if_exists .envrc-gcp
124+
fi
125+
126+
if [[ "$PWD" =~ /(terra(form)?|tf)(/|$) ]]; then
127+
load_if_exists .envrc-terraform
128+
fi
129+
113130
# ============================================================================ #
114131
# K u b e r n e t e s
115132
# ============================================================================ #

0 commit comments

Comments
 (0)