Skip to content

Commit 9d35f3c

Browse files
committed
fixing the UI
1 parent 654321c commit 9d35f3c

File tree

3 files changed

+42
-11
lines changed

3 files changed

+42
-11
lines changed

gogen-api/iam_policy.json

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,33 @@
128128
"Resource": "*"
129129
},
130130
{
131-
"Sid": "DynamoDBDescribePermissions",
131+
"Sid": "CloudFrontListPermissions",
132132
"Effect": "Allow",
133-
"Action": "dynamodb:DescribeTable",
133+
"Action": "cloudfront:ListDistributions",
134+
"Resource": "*"
135+
},
136+
{
137+
"Sid": "CloudFrontInvalidationPermissions",
138+
"Effect": "Allow",
139+
"Action": "cloudfront:CreateInvalidation",
140+
"Resource": [
141+
"arn:aws:cloudfront::715681304208:distribution/E1YKFKA6Y16FT0",
142+
"arn:aws:cloudfront::715681304208:distribution/E2PCMI0RQZI3B7"
143+
]
144+
},
145+
{
146+
"Sid": "DynamoDBPermissions",
147+
"Effect": "Allow",
148+
"Action": [
149+
"dynamodb:Scan",
150+
"dynamodb:Query",
151+
"dynamodb:GetItem",
152+
"dynamodb:PutItem",
153+
"dynamodb:UpdateItem",
154+
"dynamodb:DeleteItem"
155+
],
134156
"Resource": [
135-
"arn:aws:dynamodb:*:*:table/gogen-api-prod-gogen",
157+
"arn:aws:dynamodb:*:*:table/gogen",
136158
"arn:aws:dynamodb:*:*:table/gogen-staging"
137159
]
138160
}

ui/deploy_ui.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,18 @@ fi
6060
echo "Deploying to s3://$BUCKET/"
6161
aws s3 sync dist/ "s3://$BUCKET/" --delete
6262

63+
# Invalidate CloudFront cache
64+
echo "Looking up CloudFront distribution for $BUCKET..."
65+
DISTRIBUTION_ID=$(aws cloudfront list-distributions \
66+
--query "DistributionList.Items[?Aliases.Items[?@=='${BUCKET}']].Id | [0]" \
67+
--output text)
68+
69+
if [ -z "$DISTRIBUTION_ID" ] || [ "$DISTRIBUTION_ID" = "None" ]; then
70+
echo "Warning: No CloudFront distribution found for $BUCKET. Skipping cache invalidation."
71+
else
72+
echo "Invalidating CloudFront distribution $DISTRIBUTION_ID..."
73+
aws cloudfront create-invalidation --distribution-id "$DISTRIBUTION_ID" --paths "/*"
74+
echo "CloudFront invalidation created."
75+
fi
76+
6377
echo "Deployment completed successfully for $ENVIRONMENT environment!"

ui/src/config.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,8 @@ interface Config {
55
githubRedirectUri: string;
66
}
77

8-
function getEnvValue(name: string): string {
9-
const value = process.env[name];
10-
return value ?? '';
11-
}
12-
138
export const config: Config = {
14-
apiBaseUrl: getEnvValue('VITE_API_URL'),
15-
githubClientId: getEnvValue('VITE_GITHUB_CLIENT_ID'),
16-
githubRedirectUri: getEnvValue('VITE_GITHUB_REDIRECT_URI'),
9+
apiBaseUrl: process.env.VITE_API_URL ?? '',
10+
githubClientId: process.env.VITE_GITHUB_CLIENT_ID ?? '',
11+
githubRedirectUri: process.env.VITE_GITHUB_REDIRECT_URI ?? '',
1712
};

0 commit comments

Comments
 (0)