Skip to content

Commit

Permalink
Migrate domain name
Browse files Browse the repository at this point in the history
  • Loading branch information
ruchernchong committed Feb 14, 2024
1 parent d9e3d1d commit e61b351
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
6 changes: 3 additions & 3 deletions cdk.context.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"hosted-zone:account=173188516302:domainName=ruchern.xyz:region=ap-southeast-1": {
"Id": "/hostedzone/Z03259131HBUFZWIXRJ0O",
"Name": "ruchern.xyz."
"hosted-zone:account=173188516302:domainName=sgmotortrends.com:region=ap-southeast-1": {
"Id": "/hostedzone/Z028295527IED1A8GMZIH",
"Name": "sgmotortrends.com."
}
}
28 changes: 20 additions & 8 deletions stacks/ApiStack.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,36 @@
import { Config, StackContext, Api, Cron } from "sst/constructs";
import {
Config,
StackContext,
Api,
Cron,
ApiDomainProps,
ApiCorsProps,
} from "sst/constructs";

const CUSTOM_DOMAINS: Record<string, any> = {
const DOMAIN: string = "sgmotortrends.com";
const SITE_URL: string = `https://${DOMAIN}`;
const DEV_API_DOMAIN: string = `dev.api.${DOMAIN}`;
const PROD_API_DOMAIN: string = `api.${DOMAIN}`;

const CUSTOM_DOMAINS: Record<string, ApiDomainProps> = {
dev: {
domainName: "dev.api.singapore-ev-trends.ruchern.xyz",
hostedZone: "ruchern.xyz",
domainName: DEV_API_DOMAIN,
hostedZone: DOMAIN,
},
prod: {
domainName: "api.singapore-ev-trends.ruchern.xyz",
hostedZone: "ruchern.xyz",
domainName: PROD_API_DOMAIN,
hostedZone: DOMAIN,
},
};

const CORS_SETTINGS: Record<string, any> = {
const CORS_SETTINGS: Record<string, ApiCorsProps> = {
dev: {
allowMethods: ["GET"],
allowOrigins: ["*"],
},
prod: {
allowMethods: ["GET"],
allowOrigins: ["https://singapore-ev-trends.ruchern.xyz"],
allowOrigins: [SITE_URL],
},
};

Expand Down

0 comments on commit e61b351

Please sign in to comment.