彻底重构-1

This commit is contained in:
yml
2026-04-09 09:06:08 +08:00
parent b509394b09
commit df2eb34478
92 changed files with 2226 additions and 1261 deletions
+33 -11
View File
@@ -59,8 +59,7 @@ function loadEnvFile(filePath) {
continue
}
const value = parseEnvValue(line.slice(separatorIndex + 1))
process.env[key] = value
process.env[key] = parseEnvValue(line.slice(separatorIndex + 1))
}
}
@@ -127,14 +126,24 @@ function applyEnvOverrides(baseConfig) {
nextConfig.ocr.projectRoot = ocrProjectRoot
}
const proofMode = String(process.env.TENCENT_REDEEM_PROOF_MODE || '').trim()
if (proofMode) {
nextConfig.redeem.proofMode = proofMode
const dataRoot = String(process.env.DATA_ROOT || '').trim()
if (dataRoot) {
nextConfig.data.root = path.resolve(dataRoot)
}
const databaseFilePath = String(process.env.DATABASE_FILE_PATH || '').trim()
if (databaseFilePath) {
nextConfig.database.filePath = databaseFilePath
const databaseUrl = String(process.env.DATABASE_URL || '').trim()
if (databaseUrl) {
nextConfig.database.url = databaseUrl
}
const databaseSsl = parseBoolean(process.env.DATABASE_SSL)
if (databaseSsl !== null) {
nextConfig.database.ssl = databaseSsl
}
const databaseMaxConnections = parseInteger(process.env.DATABASE_MAX_CONNECTIONS)
if (databaseMaxConnections !== null) {
nextConfig.database.maxConnections = databaseMaxConnections
}
const claimBaseUrl = String(process.env.CLAIM_BASE_URL || '').trim()
@@ -142,11 +151,21 @@ function applyEnvOverrides(baseConfig) {
nextConfig.orders.claimBaseUrl = claimBaseUrl
}
const tokenTtlHours = parseInteger(process.env.CLAIM_TOKEN_TTL_HOURS)
if (tokenTtlHours !== null) {
nextConfig.orders.tokenTtlHours = tokenTtlHours
}
const skuMappings = parseJsonObject(process.env.ORDER_SKU_MAPPINGS_JSON)
if (skuMappings) {
nextConfig.orders.skuMappings = skuMappings
}
const fulfillmentBindings = parseJsonArray(process.env.ORDER_FULFILLMENT_BINDINGS_JSON)
if (fulfillmentBindings) {
nextConfig.orders.fulfillmentBindings = fulfillmentBindings
}
const adminSessionSecret = String(process.env.ADMIN_SESSION_SECRET || '').trim()
if (adminSessionSecret) {
nextConfig.admin.sessionSecret = adminSessionSecret
@@ -222,6 +241,11 @@ function applyEnvOverrides(baseConfig) {
nextConfig.platforms.agiso.messaging.shops = normalizeAgisoMessagingShops(agisoShops)
}
const proofMode = String(process.env.TENCENT_REDEEM_PROOF_MODE || '').trim()
if (proofMode) {
nextConfig.redeem.proofMode = proofMode
}
return nextConfig
}
@@ -269,9 +293,7 @@ function isPlainObject(value) {
}
function parseBoolean(rawValue) {
const normalized = String(rawValue || '')
.trim()
.toLowerCase()
const normalized = String(rawValue || '').trim().toLowerCase()
if (!normalized) {
return null