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.
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.
import { DEFAULT_HOST_CUSTOMER_ID } from "@/lib/constants/host-service" ;
/** Redis 宿主两步会话 TTL( 秒) */
export const HOST_PUBLIC_SESSION_TTL_SECONDS = 30 * 60 ;
export const HOST_PUBLIC_SESSION_PREFIX = "host:public:session:" ;
/** 是否开放 /api/host/* 免 Token( 后期改 false 并配 Token 即可启用鉴权) */
export function isHostPublicApiEnabled ( ) : boolean {
return process . env . HOST_PUBLIC_API_ENABLED === "true" ;
}
export function hostPublicDefaultCustomerId ( ) : string {
return (
process . env . HOST_PUBLIC_DEFAULT_CUSTOMER_ID ? . trim ( ) ||
DEFAULT_HOST_CUSTOMER_ID
) ;
}
/** 宿主同步 submit 服务端轮询间隔( 毫秒) ; embed 前端仍用 POLL_INTERVAL_MS=2s */
export const HOST_QUOTE_POLL_INTERVAL_MS_DEFAULT = 500 ;
export function getHostQuotePollIntervalMs ( ) : number {
const raw = process . env . HOST_QUOTE_POLL_INTERVAL_MS ? . trim ( ) ;
if ( ! raw ) {
return HOST_QUOTE_POLL_INTERVAL_MS_DEFAULT ;
}
const parsed = Number . parseInt ( raw , 10 ) ;
if ( ! Number . isFinite ( parsed ) || parsed < 100 ) {
return HOST_QUOTE_POLL_INTERVAL_MS_DEFAULT ;
}
return Math . min ( parsed , 2 _000 ) ;
}