Skip to content

Commit

Permalink
chore: use constant for KeyCDN suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
dcshzj authored and seaerchin committed Jun 4, 2024
1 parent 69d98e5 commit a404285
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/constants/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ export const REDIRECTION_SERVER_IPS = [
export const ALLOWED_DNS_ERROR_CODES = ["ENOTFOUND", "ENODATA"]

export const DNS_INDIRECTION_DOMAIN = "hostedon.isomer.gov.sg"
export const DNS_CNAME_SUFFIXES = ["cloudfront.net", "kxcdn.com"]
export const DNS_KEYCDN_SUFFIX = "kxcdn.com"
export const DNS_CNAME_SUFFIXES = ["cloudfront.net", DNS_KEYCDN_SUFFIX]
export const DNS_INDIRECTION_REPO = "isomer-indirection"
export const ISOMER_ADMIN_EMAIL = "[email protected]"
export const ISOMER_SUPPORT_EMAIL = "[email protected]"
Expand Down
3 changes: 2 additions & 1 deletion support/routes/v2/isobot/ops/botService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { config } from "@config/config"
import {
DNS_CNAME_SUFFIXES,
DNS_INDIRECTION_DOMAIN,
DNS_KEYCDN_SUFFIX,
REDIRECTION_SERVER_IPS,
} from "@root/constants"
import logger from "@root/logger/logger"
Expand Down Expand Up @@ -209,7 +210,7 @@ class BotService {
const isIntermediateValid =
intermediateRecords &&
((cnameRecord &&
cnameRecord.endsWith(".kxcdn.com") &&
cnameRecord.endsWith(`.${DNS_KEYCDN_SUFFIX}`) &&
intermediateRecords.length === 1) ||
(intermediateRecords.length === 4 &&
(isDomainCnameCorrect ||
Expand Down

0 comments on commit a404285

Please sign in to comment.