Skip to content

Commit

Permalink
Migrate domain name
Browse files Browse the repository at this point in the history
Temporarily keep old domain name in CORS allowed origins
  • Loading branch information
Ru Chern Chong committed Aug 3, 2024
1 parent 917e0ec commit 8d486b8
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions sst.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference path="./.sst/platform/config.d.ts" />

const DOMAIN_NAME = "sgmotortrends.com";
const DOMAIN_NAME = "sgcarstrends.com";

const CORS = {
dev: {
Expand All @@ -10,16 +10,20 @@ const CORS = {
allowOrigins: ["*"],
},
prod: {
allowOrigins: [`https://${DOMAIN_NAME}`],
allowOrigins: [
`https://${DOMAIN_NAME}`,
// TODO: To be removed
"https://sgmotortrends.com",
],
maxAge: "1 day",
},
};

const DOMAIN = {
dev: `dev.api.${DOMAIN_NAME}`,
staging: `staging.api.${DOMAIN_NAME}`,
prod: `api.${DOMAIN_NAME}`,
} as const;
dev: { name: `dev.api.${DOMAIN_NAME}` },
staging: { name: `staging.api.${DOMAIN_NAME}` },
prod: { name: `api.${DOMAIN_NAME}` },
};

export default $config({
app(input) {
Expand All @@ -31,6 +35,7 @@ export default $config({
aws: {
region: "ap-southeast-1",
},
cloudflare: true,
},
};
},
Expand All @@ -48,7 +53,10 @@ export default $config({
});

new sst.aws.Router("LTACarsDataset", {
domain: DOMAIN[$app.stage],
domain: {
...DOMAIN[$app.stage],
dns: sst.cloudflare.dns(),
},
routes: {
"/*": api.url,
},
Expand Down

0 comments on commit 8d486b8

Please sign in to comment.