Skip to content

Commit

Permalink
chore: create env file that gets automatically loaded when we start t…
Browse files Browse the repository at this point in the history
…he infra in Localstack (#592)
  • Loading branch information
craigzour authored Feb 8, 2024
1 parent f3958a2 commit b28c633
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
APP_ENV="local"
NOTIFY_API_KEY="<can_be_found_in_1Password>"
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ tf.plan
.devcontainer/data

# Local environment variables
.env*
.env
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ RELIABILITY_FILE_STORAGE=forms-local-reliability-file-storage
LOCAL_AWS_ENDPOINT=http://127.0.0.1:4566
```

#### Set your environment variables (optional)

Copy the `.env.example` file and rename it to `.env`. Some of the variables require values that can be found in the 1Password shared secrets note.

#### Launch the infrastructure and the application

Everytime you want to run localstack and lambdas locally

1. In one terminal run `docker-compose up`
Expand Down
21 changes: 15 additions & 6 deletions localstack_services.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
#!/bin/bash

export APP_ENV="local"

# Exit on any error
set -e

# Text colors
color='\033[1;95m'
reset='\033[0m' # No Color

if test -f .env
then
set -o allexport
source .env
set +o allexport
printf "${color}=> Environment variables loaded from .env${reset}\n"
else
# In case developers have not set up their .env file (can be removed in the future)
export APP_ENV="local"
fi

# Exit on any error
set -e

# Set proper terraform and terragrunt versions

tgswitch 0.54.8
Expand Down Expand Up @@ -65,4 +74,4 @@ printf "${color}...Creating lambdas${reset}\n"
cd $basedir/env/cloud/lambdas
terragrunt apply --terragrunt-non-interactive -auto-approve --terragrunt-log-level warn

printf "${color}All infratructure initialized: Ready for requests${reset}\n"
printf "${color}All infratructure initialized: Ready for requests${reset}\n"

0 comments on commit b28c633

Please sign in to comment.