Skip to content

Commit

Permalink
fix: test script for checking changes
Browse files Browse the repository at this point in the history
  • Loading branch information
PikkaPikkachu committed Jul 29, 2023
1 parent 6a16fe1 commit 41a79c4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
5 changes: 4 additions & 1 deletion .platform/hooks/postdeploy/01_fetch_ssm_parameters.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/bin/bash

ENV_TYPE=$(/opt/elasticbeanstalk/bin/get-config environment -k SSM_PREFIX)
ENV_VARS=("SGID_CLIENT_ID" "SGID_CLIENT_SECRET" "SGID_PRIVATE_KEY") # Add any additional env vars to this array
# ENV_VARS=("SGID_CLIENT_ID" "SGID_CLIENT_SECRET" "SGID_PRIVATE_KEY") # Add any additional env vars to this array

ENV_VARS=("SGID_CLIENT_ID")

echo "Set AWS region"
aws configure set default.region ap-southeast-1
Expand All @@ -10,6 +12,7 @@ for ENV_VAR in "${ENV_VARS[@]}"; do
echo "Running for this ${ENV_TYPE}"
echo "Fetching ${ENV_VAR} from SSM"
VALUE=$(aws ssm get-parameter --name "${ENV_TYPE}_${ENV_VAR}" --with-decryption --query "Parameter.Value" --output text)
echo "These are the values ${ENV_VAR}=${VALUE}"
echo "${ENV_VAR}=${VALUE}" >> /opt/elasticbeanstalk/deployment/env
echo "Saved ${ENV_VAR}"
done
4 changes: 0 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,7 @@ services:
- REDIS_SAFE_BROWSING_URI=redis://redis:6379/4
- SESSION_SECRET=thiscouldbeanything
- GA_TRACKING_ID=UA-139330318-1
- SGID_PRIVATE_KEY=

- SGID_API_HOSTNAME=https://api.id.gov.sg
- SGID_CLIENT_ID=
- SGID_CLIENT_SECRET=

- OG_URL=https://go.gov.sg
- VALID_EMAIL_GLOB_EXPRESSION=*.gov.sg
Expand Down
14 changes: 9 additions & 5 deletions src/server/services/sgid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ class SgidService {
redirectUri,
hostname,
}: SgidServiceOption) {
console.log('This is the client ID', clientId, redirectUri)
console.log(
'This is the client ID',
process.env.SGID_CLIENT_ID,
process.env.SGID_API_HOSTNAME,
)
try {
this.sgidClient = new SgidClient({
clientId,
Expand Down Expand Up @@ -93,9 +97,9 @@ class SgidService {

// Initialised the sgidService object with the different environments
export const SgidAuthService = new SgidService({
clientId: process.env.SGID_CLIENT_ID as string,
clientSecret: process.env.SGID_CLIENT_SECRET as string,
privateKey: process.env.SGID_PRIVATE_KEY as string,
clientId: process.env.SGID_CLIENT_ID || '',
clientSecret: process.env.SGID_CLIENT_SECRET || '',
privateKey: process.env.SGID_PRIVATE_KEY || '',
redirectUri: `${process.env.OG_URL}/api/sgidLogin/authenticate`,
hostname: process.env.SGID_API_HOSTNAME as string,
hostname: process.env.SGID_API_HOSTNAME || '',
})

0 comments on commit 41a79c4

Please sign in to comment.