feat: /api/healthz 추가, node 22.11.0 수정, 사이트맵 삭제, env.qa 추가
This commit is contained in:
22
.env.qa
Normal file
22
.env.qa
Normal file
@@ -0,0 +1,22 @@
|
||||
RUN_TYPE=live
|
||||
BASE_DOMAIN='.onstove.com'
|
||||
|
||||
# URLS ##############################################################################
|
||||
STATIC_URL='https://static-pubcomm.gate8.com'
|
||||
|
||||
# STOVE #############################################################################
|
||||
# STOVE - API Url
|
||||
STOVE_API_URL=https://api.gate8.com
|
||||
STOVE_M_API_URL=https://maintenance.gate8.com
|
||||
|
||||
# STOVE - GNB
|
||||
STOVE_GNB=https://js-cdn-qa.onstove.com/libs/common-gnb/latest/cp-header.js
|
||||
|
||||
# STOVE - Client Download
|
||||
STOVE_LAUNCHER_SCRIPT=https://js-cdn.gate8.com/libs/stove-js-service/latest/launcher-pack.js
|
||||
STOVE_CLIENT_DOWNLOAD_URL=https://sgs-gate8-dl.game.playstove.com/game/lcs/STOVESetup.exe
|
||||
STOVE_LOGIN_URL=https://accounts-qa.onstove.com/login
|
||||
|
||||
# Log Tracking ######################################################################
|
||||
# 81plug
|
||||
STOVE_81PLUG=https://dvudc0gwzz5wc.cloudfront.net/v3.1/qa/svc_81plug.min.js
|
||||
6
layers/server/api/healthz.ts
Normal file
6
layers/server/api/healthz.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export default defineEventHandler(() => {
|
||||
return {
|
||||
code: 200,
|
||||
message: 'success'
|
||||
}
|
||||
})
|
||||
@@ -1,67 +0,0 @@
|
||||
// server/routes/sitemap.xml.ts
|
||||
type SitemapUrl = {
|
||||
loc: string
|
||||
lastmod?: string
|
||||
changefreq?: 'always' | 'hourly' | 'daily' | 'weekly' | 'monthly' | 'yearly' | 'never'
|
||||
priority?: number
|
||||
}
|
||||
|
||||
type SitemapConfig = {
|
||||
urls: SitemapUrl[]
|
||||
cache?: { sMaxAge?: number; staleWhileRevalidate?: number }
|
||||
}
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
const host = (getHeader(event, "host") || getRequestHost(event)).toString() || "";
|
||||
const baseDomain = process.env.BASE_DOMAIN || ".onstove.com";
|
||||
const isGameAliasExtractable = host.includes(baseDomain);
|
||||
|
||||
let gameAlias = "";
|
||||
if (isGameAliasExtractable) {
|
||||
gameAlias = host.split(".")[0] || "";
|
||||
}
|
||||
|
||||
let config: SitemapConfig;
|
||||
|
||||
|
||||
try {
|
||||
// 외부 API에서 sitemap 설정 가져오기
|
||||
const response = await $fetch('https://static-pubcomm.gate8.com/dev/test0905/dataization/test0905_homepage_brand_siteConfig.json') as any;
|
||||
|
||||
// sitemap 설정에서 urls만 추출
|
||||
const sitemapUrls = response.sitemap?.urls || [];
|
||||
|
||||
config = {
|
||||
urls: sitemapUrls,
|
||||
cache: { sMaxAge: 3600, staleWhileRevalidate: 7200 }
|
||||
};
|
||||
} catch (error) {
|
||||
console.error('Failed to fetch sitemap config:', error);
|
||||
|
||||
// 에러 발생 시 빈 배열 반환
|
||||
config = {
|
||||
urls: [],
|
||||
cache: { sMaxAge: 3600, staleWhileRevalidate: 7200 }
|
||||
};
|
||||
}
|
||||
|
||||
setHeader(event, "Content-Type", "application/xml; charset=utf-8");
|
||||
|
||||
// 캐시 헤더 (CDN 친화)
|
||||
const sMax = config.cache?.sMaxAge ?? 3600;
|
||||
const swr = config.cache?.staleWhileRevalidate ?? 7200;
|
||||
setHeader(event, "Cache-Control", `public, s-maxage=${sMax}, stale-while-revalidate=${swr}`);
|
||||
|
||||
// XML 생성
|
||||
const xml = `<?xml version="1.0" encoding="UTF-8"?>
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
${config.urls.map(url => ` <url>
|
||||
<loc>${url.loc}</loc>
|
||||
${url.lastmod ? ` <lastmod>${url.lastmod}</lastmod>` : ''}
|
||||
${url.changefreq ? ` <changefreq>${url.changefreq}</changefreq>` : ''}
|
||||
${url.priority ? ` <priority>${url.priority}</priority>` : ''}
|
||||
</url>`).join('\n')}
|
||||
</urlset>`;
|
||||
|
||||
return xml;
|
||||
});
|
||||
18
package.json
18
package.json
@@ -3,13 +3,18 @@
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev:dev": "nuxt dev --dotenv .env.dev --host",
|
||||
"dev:sandbox": "nuxt dev --dotenv .env.sandbox --host",
|
||||
"dev:live": "nuxt dev --dotenv .env.live --host",
|
||||
"build": "nuxt build",
|
||||
"build:dev": "nuxt build --dotenv .env.dev",
|
||||
"build:sandbox": "nuxt build --dotenv .env.sandbox",
|
||||
"build:live": "nuxt build --dotenv .env.live",
|
||||
"build:dev": "cross-env RUN_TYPE=dev nuxt build --dotenv .env.dev",
|
||||
"build:dev2": "cross-env RUN_TYPE=dev nuxt build --dotenv .env.dev",
|
||||
"build:qa": "cross-env RUN_TYPE=qa nuxt build --dotenv .env.qa",
|
||||
"build:qa2": "cross-env RUN_TYPE=qa nuxt build --dotenv .env.qa",
|
||||
"build:perf": "cross-env RUN_TYPE=perf nuxt build --dotenv .env.perf",
|
||||
"build:sandbox": "cross-env RUN_TYPE=sandbox nuxt build --dotenv .env.sandbox",
|
||||
"build:live": "cross-env RUN_TYPE=live nuxt build --dotenv .env.live",
|
||||
"dev:dev": "cross-env RUN_TYPE=dev nuxt dev --dotenv .env.dev --host",
|
||||
"dev:sandbox": "cross-env RUN_TYPE=sandbox nuxt dev --dotenv .env.sandbox --host",
|
||||
"dev:qa": "cross-env RUN_TYPE=qa nuxt dev --dotenv .env.qa --host",
|
||||
"dev:live": "cross-env RUN_TYPE=live nuxt dev --dotenv .env.live --host",
|
||||
"preview": "nuxt preview",
|
||||
"typecheck": "vue-tsc --noEmit",
|
||||
"lint": "eslint . --ext .vue,.js,.ts,.jsx,.tsx",
|
||||
@@ -44,6 +49,7 @@
|
||||
"@typescript-eslint/eslint-plugin": "^8.43.0",
|
||||
"@typescript-eslint/parser": "^8.43.0",
|
||||
"autoprefixer": "^10.4.21",
|
||||
"cross-env": "^10.1.0",
|
||||
"eslint": "^9.35.0",
|
||||
"eslint-config-prettier": "^10.1.8",
|
||||
"eslint-plugin-nuxt": "^4.0.0",
|
||||
|
||||
18
pnpm-lock.yaml
generated
18
pnpm-lock.yaml
generated
@@ -78,6 +78,9 @@ importers:
|
||||
autoprefixer:
|
||||
specifier: ^10.4.21
|
||||
version: 10.4.21(postcss@8.5.6)
|
||||
cross-env:
|
||||
specifier: ^10.1.0
|
||||
version: 10.1.0
|
||||
eslint:
|
||||
specifier: ^9.35.0
|
||||
version: 9.35.0(jiti@2.5.1)
|
||||
@@ -308,6 +311,9 @@ packages:
|
||||
'@emnapi/wasi-threads@1.1.0':
|
||||
resolution: {integrity: sha512-WI0DdZ8xFSbgMjR1sFsKABJ/C5OnRrjT06JXbZKexJGrDuPTzZdDYfFlsgcCXCyf+suG5QU2e/y1Wo2V/OapLQ==}
|
||||
|
||||
'@epic-web/invariant@1.0.0':
|
||||
resolution: {integrity: sha512-lrTPqgvfFQtR/eY/qkIzp98OGdNJu0m5ji3q/nJI8v3SXkRKEnWiOxMmbvcSoAIzv/cGiuvRy57k4suKQSAdwA==}
|
||||
|
||||
'@es-joy/jsdoccomment@0.56.0':
|
||||
resolution: {integrity: sha512-c6EW+aA1w2rjqOMjbL93nZlwxp6c1Ln06vTYs5FjRRhmJXK8V/OrSXdT+pUr4aRYgjCgu8/OkiZr0tzeVrRSbw==}
|
||||
engines: {node: '>=20.11.0'}
|
||||
@@ -2219,6 +2225,11 @@ packages:
|
||||
resolution: {integrity: sha512-p9nwwR4qyT5W996vBZhdvBCnMhicY5ytZkR4D1Xj0wuTDEiMnjwR57Q3RXYY/s0EpX6Ay3vgIcfaR+ewGHsi+g==}
|
||||
engines: {node: '>=18.0'}
|
||||
|
||||
cross-env@10.1.0:
|
||||
resolution: {integrity: sha512-GsYosgnACZTADcmEyJctkJIoqAhHjttw7RsFrVoJNXbsWWqaq6Ym+7kZjq6mS45O0jij6vtiReppKQEtqWy6Dw==}
|
||||
engines: {node: '>=20'}
|
||||
hasBin: true
|
||||
|
||||
cross-spawn@7.0.6:
|
||||
resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==}
|
||||
engines: {node: '>= 8'}
|
||||
@@ -5092,6 +5103,8 @@ snapshots:
|
||||
tslib: 2.8.1
|
||||
optional: true
|
||||
|
||||
'@epic-web/invariant@1.0.0': {}
|
||||
|
||||
'@es-joy/jsdoccomment@0.56.0':
|
||||
dependencies:
|
||||
'@types/estree': 1.0.8
|
||||
@@ -7051,6 +7064,11 @@ snapshots:
|
||||
|
||||
croner@9.1.0: {}
|
||||
|
||||
cross-env@10.1.0:
|
||||
dependencies:
|
||||
'@epic-web/invariant': 1.0.0
|
||||
cross-spawn: 7.0.6
|
||||
|
||||
cross-spawn@7.0.6:
|
||||
dependencies:
|
||||
path-key: 3.1.1
|
||||
|
||||
Reference in New Issue
Block a user