Skip to content

Commit 025e397

Browse files
author
Yuriy
committed
chore(java-spring-ai-agents): refactor setup script environment variable handling
1 parent 4716e95 commit 025e397

1 file changed

Lines changed: 5 additions & 13 deletions

File tree

apps/java-spring-ai-agents/scripts/01-setup.sh

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,6 @@ echo "=============================================="
55
echo "01-setup.sh - Environment Setup"
66
echo "=============================================="
77

8-
# Get account ID and region
9-
ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text --no-cli-pager)
10-
AWS_REGION=$(aws configure get region)
11-
12-
echo "Account: ${ACCOUNT_ID}"
13-
echo "Region: ${AWS_REGION}"
14-
158
## Creating the environment directory
169

1710
echo ""
@@ -67,18 +60,17 @@ else
6760
~/environment/backoffice/src/main/resources/application.properties
6861
fi
6962

70-
# Add basic variables to .envrc if not already in the environment
63+
# Verify required environment variables
7164
if [ -z "${AWS_REGION}" ]; then
72-
AWS_REGION=$(aws configure get region)
65+
echo "Error: AWS_REGION is not set"
66+
exit 1
7367
fi
7468
if [ -z "${ACCOUNT_ID}" ]; then
7569
ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text --no-cli-pager)
7670
fi
7771

78-
grep -q "AWS_REGION=" ~/environment/.envrc 2>/dev/null || \
79-
echo "export AWS_REGION=${AWS_REGION}" >> ~/environment/.envrc
80-
grep -q "ACCOUNT_ID=" ~/environment/.envrc 2>/dev/null || \
81-
echo "export ACCOUNT_ID=${ACCOUNT_ID}" >> ~/environment/.envrc
72+
echo "Account: ${ACCOUNT_ID}"
73+
echo "Region: ${AWS_REGION}"
8274

8375
## Setting up direnv
8476

0 commit comments

Comments
 (0)