Skip to content

Commit 691a912

Browse files
Update compatibility with 4.0 (#15)
* update ephemeral script to use the cli instead of the deprecated api key * fix typo in readme link * fixed typo in requirements file * removed env dict * fix leaderboard when less than 3 results on a quizz * switch to auth token in workflow --------- Co-authored-by: Harsh Mishra <[email protected]>
1 parent 2a3a38a commit 691a912

File tree

5 files changed

+15
-30
lines changed

5 files changed

+15
-30
lines changed

.github/workflows/ephemeral.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
5252
echo "NEW_URL=$NEW_URL" >> $GITHUB_ENV
5353
env:
54-
LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }}
54+
LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }}
5555

5656
- name: Generate index.html with New Redirect URL
5757
run: |

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ For testing the app within the GitHub Actions workflow, you can refer to the pro
137137

138138
## IAM Policy Stream
139139

140-
Visit the [IAM Policy Stream](https://app.localstack.cloud/policy-stream) to view the permissions required for each API call. This feature enables you to explore and progressively enhance security as your application develops.
140+
Visit the [IAM Policy Stream](https://app.localstack.cloud/inst/default/policy-stream) to view the permissions required for each API call. This feature enables you to explore and progressively enhance security as your application develops.
141141

142142
To get started, restart the LocalStack container using the command `localstack restart` and load the Cloud Pod. Then, click on **Enable**.
143143

bin/ephemeral.sh

100644100755
Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,17 @@
11
#!/bin/bash
22

3-
if [ -z "$LOCALSTACK_API_KEY" ]; then
4-
echo "Error: LOCALSTACK_API_KEY environment variable is not set."
5-
exit 1
6-
fi
7-
83
INSTANCE_NAME="instance-$(openssl rand -hex 4)"
94
echo "Creating ephemeral instance with name: $INSTANCE_NAME"
105

11-
ENV_VARS_JSON=$(cat <<EOF
12-
{
13-
"LAMBDA_KEEPALIVE_MS": "7200000",
14-
"EXTENSION_AUTO_INSTALL": "localstack-extension-mailhog",
15-
"DISABLE_CUSTOM_CORS_APIGATEWAY": "1",
16-
"DISABLE_CUSTOM_CORS_S3": "1"
17-
}
18-
EOF
6+
CREATE_RESPONSE=$(localstack ephemeral create \
7+
--name "$INSTANCE_NAME" \
8+
--lifetime 120 \
9+
--env LAMBDA_KEEPALIVE_MS=7200000 \
10+
--env EXTENSION_AUTO_INSTALL=localstack-extension-mailhog \
11+
--env DISABLE_CUSTOM_CORS_APIGATEWAY=1 \
12+
--env DISABLE_CUSTOM_CORS_S3=1
1913
)
2014

21-
CREATE_RESPONSE=$(curl -s -X POST https://api.localstack.cloud/v1/compute/instances \
22-
-H "Content-Type: application/json" \
23-
-H "ls-api-key: $LOCALSTACK_API_KEY" \
24-
-d '{
25-
"instance_name": "'"$INSTANCE_NAME"'",
26-
"lifetime": 120,
27-
"env_vars": '"$ENV_VARS_JSON"'
28-
}')
29-
3015
if echo "$CREATE_RESPONSE" | grep -q '"endpoint_url"'; then
3116
echo "Ephemeral instance created successfully."
3217
else

frontend/src/components/LeaderboardPage.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,15 @@ function LeaderboardPage() {
105105
marginRight: 'auto',
106106
}}
107107
>
108-
{leaderboardData[1].Username}
108+
{leaderboardData[1]?.Username}
109109
</Typography>
110110
<div className="score">
111111
<img
112112
src={StarSharp}
113113
alt="Score"
114114
style={{ float: 'left', marginLeft: '10px' }}
115115
/>
116-
{leaderboardData[1].Score}
116+
{leaderboardData[1]?.Score}
117117
</div>
118118
</div>
119119
<div className="podium first-place">
@@ -126,15 +126,15 @@ function LeaderboardPage() {
126126
marginRight: 'auto',
127127
}}
128128
>
129-
{leaderboardData[0].Username}
129+
{leaderboardData[0]?.Username}
130130
</Typography>
131131
<div className="score">
132132
<img
133133
src={StarSharp}
134134
alt="Score"
135135
style={{ float: 'left', marginLeft: '10px' }}
136136
/>
137-
{leaderboardData[0].Score}
137+
{leaderboardData[0]?.Score}
138138
</div>
139139
</div>
140140
<div className="podium third-place">
@@ -147,15 +147,15 @@ function LeaderboardPage() {
147147
marginRight: 'auto',
148148
}}
149149
>
150-
{leaderboardData[2].Username}
150+
{leaderboardData[2]?.Username}
151151
</Typography>
152152
<div className="score">
153153
<img
154154
src={StarSharp}
155155
alt="Score"
156156
style={{ float: 'left', marginLeft: '10px' }}
157157
/>
158-
{leaderboardData[2].Score}
158+
{leaderboardData[2]?.Score}
159159
</div>
160160
</div>
161161
</div>

0 commit comments

Comments
 (0)