Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .ebextensions/25-load-sgid-env.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# loads SGID environment variables to a .env file from SSM

commands:
01-create-env:
command: "/tmp/create-env.sh"

files:
"/tmp/create-env.sh":
mode: "000755"
content : |
#!/bin/bash
ENV_NAME=$(/opt/elasticbeanstalk/bin/get-config environment -k SSM_PREFIX)

ENV_VARS=("SGID_CLIENT_ID" "SGID_CLIENT_SECRET" "SGID_PRIVATE_KEY")

echo "Set AWS region"
aws configure set default.region ap-southeast-1

TARGET_DIR=/etc/gogovsg

echo "Checking if ${TARGET_DIR} exists..."
if [ ! -d ${TARGET_DIR} ]; then
echo "Creating directory ${TARGET_DIR} ..."
mkdir -p ${TARGET_DIR}
if [ $? -ne 0 ]; then
echo 'ERROR: Directory creation failed!'
exit 1
fi
else
echo "Directory ${TARGET_DIR} already exists!"
fi

echo "Creating config for ${ENV_NAME} in ${AWS_REGION}"

for ENV_VAR in "${ENV_VARS[@]}"; do
echo "Running for this ${ENV_NAME}"
echo "Fetching ${ENV_VAR} from SSM"
VALUE=$(aws ssm get-parameter --name "${ENV_NAME}_${ENV_VAR}" --with-decryption --query "Parameter.Value" --output text)
echo "${ENV_VAR}=${VALUE}" >> $TARGET_DIR/.env
echo "Saved ${ENV_VAR}"
done
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,22 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### [v1.77.1](https://github.com/opengovsg/GoGovSG/compare/v1.77.0...v1.77.1)

- fix: stored xss via file upload [`#2258`](https://github.com/opengovsg/GoGovSG/pull/2258)
- Develop 1.77.0 [`#2250`](https://github.com/opengovsg/GoGovSG/pull/2250)

#### [v1.77.0](https://github.com/opengovsg/GoGovSG/compare/v1.76.1...v1.77.0)

> 3 August 2023

- Experiment go <> sgid integration [`#2247`](https://github.com/opengovsg/GoGovSG/pull/2247)
- [develop] 1.76.1 [`#2241`](https://github.com/opengovsg/GoGovSG/pull/2241)

#### [v1.76.1](https://github.com/opengovsg/GoGovSG/compare/v1.76.0...v1.76.1)

> 13 July 2023

- build(deps): bump semver from 7.3.8 to 7.5.4 [`#2239`](https://github.com/opengovsg/GoGovSG/pull/2239)
- build(deps): bump react-vis from 1.11.7 to 1.11.8 [`#2238`](https://github.com/opengovsg/GoGovSG/pull/2238)
- build(deps): bump @sentry/cli from 1.67.2 to 1.75.2 [`#2231`](https://github.com/opengovsg/GoGovSG/pull/2231)
Expand Down
6 changes: 6 additions & 0 deletions Dockerrun.aws.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,11 @@
{
"ContainerPort": "8080"
}
],
"Volumes": [
{
"HostDirectory": "/etc/gogovsg/.env",
"ContainerDirectory": "/usr/src/gogovsg/.env"
}
]
}
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ services:
- REDIS_SAFE_BROWSING_URI=redis://redis:6379/4
- SESSION_SECRET=thiscouldbeanything
- GA_TRACKING_ID=UA-139330318-1
- SGID_API_HOSTNAME=https://api.id.gov.sg

- OG_URL=https://go.gov.sg
- VALID_EMAIL_GLOB_EXPRESSION=*.gov.sg
- COOKIE_MAX_AGE=86400000
Expand Down
Loading