You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
1.2 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

/** 内网宿主系统默认 Service Token与 deploy/.env.bt-host-mysql.example 中 HOST_SERVICE_TOKENS key 一致) */
export const DEFAULT_HOST_SERVICE_TOKEN = "chajia-neibu-2026";
export const DEFAULT_HOST_CUSTOMER_ID = "CUST_001";
/** embed-demo 演示页 Token构建时 NEXT_PUBLIC_* 可覆盖,默认与 DEFAULT_HOST_SERVICE_TOKEN 相同) */
export const EMBED_DEMO_SERVICE_TOKEN =
process.env.NEXT_PUBLIC_EMBED_DEMO_SERVICE_TOKEN?.trim() ||
DEFAULT_HOST_SERVICE_TOKEN;
export const EMBED_DEMO_CUSTOMER_ID =
process.env.NEXT_PUBLIC_EMBED_DEMO_CUSTOMER_ID?.trim() ||
DEFAULT_HOST_CUSTOMER_ID;
/**
* 本地开发是否跳过宿主 Service Token 鉴权quotes / priority1 / addresses 等)。
* - production始终 false
* - development默认 true设 HOST_SERVICE_AUTH_DISABLED=false 可恢复校验
*/
export function isHostServiceAuthDisabled(): boolean {
if (process.env.NODE_ENV === "production") {
return false;
}
const raw = process.env.HOST_SERVICE_AUTH_DISABLED?.trim().toLowerCase();
if (raw === "false" || raw === "0" || raw === "no") {
return false;
}
if (raw === "true" || raw === "1" || raw === "yes") {
return true;
}
return process.env.NODE_ENV === "development";
}