-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
34 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# Retrieve secret by id from AWS Secrets Manager | ||
getSecretFromAWS() { | ||
local secret_id="$1" | ||
sudo aws secretsmanager get-secret-value --secret-id "$secret_id" | grep SecretString | sed 's/.*"SecretString": "\(.*\)".*/\1/' | ||
} | ||
|
||
# Retrieve all envs from AWS | ||
ENV_DEV=$(getSecretFromAWS "core/dev/mobile/.env.development") | ||
ENV_DEV_E2E=$(getSecretFromAWS "core/dev/mobile/.env.development.e2e") | ||
ENV_PROD=$(getSecretFromAWS "core/dev/mobile/.env.production") | ||
ENV_PROD_E2E=$(getSecretFromAWS "core/dev/mobile/.env.production.e2e") | ||
|
||
# Write to env files | ||
./scripts/common/writeEnvsToFile.sh "$ENV_DEV" ".env.development" | ||
./scripts/common/writeEnvsToFile.sh "$ENV_DEV_E2E" ".env.development.e2e" | ||
./scripts/common/writeEnvsToFile.sh "$ENV_PROD" ".env.production" | ||
./scripts/common/writeEnvsToFile.sh "$ENV_PROD_E2E" ".env.production.e2e" | ||
|
||
# Use .env.development as the default | ||
cp .env.development .env | ||
echo ".env.development copied to .env" | ||
echo "envs successfully retrieved and saved 🥳" |