Files
medical-mall/ak/config.uts

185 lines
7.9 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// // Supabase 配置
// // 内网环境 - 本地部署的 Supabase
// // IP: 192.168.1.62
// // Kong HTTP Port: 8000
// //自己的配置自己解开即可
// // export const SUPA_URL: string = 'http://119.146.131.237:9129'
// // export const SUPA_KEY: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vbiIsImlzcyI6InN1cGFiYXNlIiwiaWF0IjoxNzY4ODMwNjI0LCJleHAiOjE5MjY1MTA2MjR9.mDVl-kIOdRK9v6VTxo0TDF8r7X7xk3PZXazaavHyVvg1234567890'
// //export const SUPA_URL: string = 'http://192.168.1.62:18000'
// //export const SUPA_KEY: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vbiIsImlzcyI6InN1cGFiYXNlLTEiLCJpYXQiOjE3Njk2NzY0OTgsImV4cCI6MTkyNzM1NjQ5OH0.ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'
// // export const SUPA_URL: string = 'http://192.168.1.61:18000'
// // export const SUPA_KEY: string = 'eyJhbGciOiAiSFMyNTYiLCAidHlwIjogIkpXVCJ9.eyJyb2xlIjogImFub24iLCAiaXNzIjogInN1cGFiYXNlIiwgImlhdCI6IDE3Njk4NDczMzQsICJleHAiOiAyMDg1MjA3MzM0fQ.js-2CS5_cUmf4iVv8aCmmx9iyFsQvLNDbt8YYOngeLU'
// // export const SUPA_URL: string = 'http://119.146.131.237:9126'
// // export const SUPA_KEY: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vbiIsImlzcyI6InN1cGFiYXNlLTEiLCJpYXQiOjE3Njk2NzY0OTgsImV4cCI6MTkyNzM1NjQ5OH0.ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'
// // 当前直接复用 mall 项目已验证可用的 Kong API 网关和 anon key。
// export const SUPA_URL: string = 'http://119.146.131.237:9126'
// export const SUPA_KEY: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vbiIsImlzcyI6InN1cGFiYXNlLTEiLCJpYXQiOjE3Njk2NzY0OTgsImV4cCI6MTkyNzM1NjQ5OH0.ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'
// // WebSocket 实时连接(内网使用 ws:// 而非 wss://
// // export const WS_URL: string = 'ws://192.168.1.61:18000/realtime/v1/websocket'
// //export const WS_URL: string = 'ws://192.168.1.62:18000/realtime/v1/websocket'
// export const WS_URL: string = 'ws://192.168.1.61:18000/realtime/v1/websocket'
// //cyh
// // export const WS_URL: string = 'ws://119.146.131.237:9126/realtime/v1/websocket'
// //export const WS_URL: string = 'ws://localhost:18000/realtime/v1/websocket'
// //hzb
// // 医疗项目 9127 实例 WebSocket如需启用实时功能请取消注释并填写真实 key 后启用)
// // export const WS_URL: string = 'ws://119.146.131.237:9127/realtime/v1/websocket'
// // 推送服务地址(用于本地调试,可改为 http://<your-ip>:7301
// export const PUSH_SERVER_URL: string = 'http://192.168.1.62:7301'
// // 备用配置(已注释,如需切换可取消注释)
// // 开发环境 - 其他内网地址
// // export const SUPA_URL: string = 'http://192.168.0.150:8080'
// // export const SUPA_KEY: string = 'your-anon-key'
// // export const WS_URL: string = 'ws://192.168.0.150:8080/realtime/v1/websocket'
// // 生产环境 - Supabase 云服务(已注释)
// // export const SUPA_URL: string = 'https://ak3.oulog.com'
// // export const SUPA_KEY: string = 'your-anon-key'
// // export const WS_URL: string = 'wss://ak3.oulog.com/realtime/v1/websocket'
// // 指向你的 Supabase 服务(开发/私有部署)
// // export const SUPA_URL: string = 'http://192.168.1.64:3000'
// // export const SUPA_KEY: string = 'your-anon-key'
// // export const WS_URL: string = 'ws://192.168.1.64:3000/realtime/v1'
// // 路由配置
// export const HOME_REDIRECT: string = '/pages/main/index'
// export const TABORPAGE: string = '/pages/main/index'
// // 测试模式:放开任意跳转(禁用启动页/登录/401 的强制重定向)
// export const IS_TEST_MODE: boolean = true
// /**
// * 打印当前 Supabase 配置key 脱敏只打印前10位+后8位
// * 在页面 onLoad 时调用,用于确认运行时实际使用的是哪套配置
// */
// export function logSupaConfig() {
// const keyLen = SUPA_KEY.length
// const masked = keyLen > 20
// ? SUPA_KEY.substring(0, 10) + '...' + SUPA_KEY.substring(keyLen - 8)
// : '(too short)'
// console.log('[SupaConfig] SUPA_URL :', SUPA_URL)
// console.log('[SupaConfig] SUPA_KEY :', masked)
// }
import { CURRENT_CLIENT as ACTIVE_CLIENT } from '@/config/current-client.uts'
type RuntimeProfile = {
client: string
supaUrl: string
supaKey: string
wsUrl: string
pushServerUrl: string
homeRedirect: string
taborPage: string
testMode: boolean
}
// consumer 配置来自历史可用版本 0ffbc5390与 2026-05-18 / 2026-05-19 的 pages.consumer 备份一致。
const consumerProfile: RuntimeProfile = {
client: 'consumer',
supaUrl: 'http://119.146.131.237:9126',
supaKey: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vbiIsImlzcyI6InN1cGFiYXNlLTEiLCJpYXQiOjE3Njk2NzY0OTgsImV4cCI6MTkyNzM1NjQ5OH0.ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890',
wsUrl: 'ws://192.168.1.61:18000/realtime/v1/websocket',
pushServerUrl: 'http://192.168.1.62:7301',
homeRedirect: '/pages/main/index',
taborPage: '/pages/main/index',
testMode: true,
}
const merchantProfile: RuntimeProfile = {
client: 'merchant',
supaUrl: 'http://119.146.131.237:9129',
supaKey: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vbiIsImlzcyI6InN1cGFiYXNlIiwiaWF0IjoxNzY4ODMwNjI0LCJleHAiOjE5MjY1MTA2MjR9.mDVl-kIOdRK9v6VTxo0TDF8r7X7xk3PZXazaavHyVvg1234567890',
wsUrl: 'ws://192.168.1.61:18000/realtime/v1/websocket',
pushServerUrl: 'http://192.168.1.62:7301',
homeRedirect: '/pages/mall/merchant/index',
taborPage: '',
testMode: true,
}
const adminProfile: RuntimeProfile = {
client: 'admin',
supaUrl: 'http://119.146.131.237:9129',
supaKey: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vbiIsImlzcyI6InN1cGFiYXNlIiwiaWF0IjoxNzY4ODMwNjI0LCJleHAiOjE5MjY1MTA2MjR9.mDVl-kIOdRK9v6VTxo0TDF8r7X7xk3PZXazaavHyVvg1234567890',
wsUrl: 'ws://192.168.1.61:18000/realtime/v1/websocket',
pushServerUrl: 'http://192.168.1.62:7301',
homeRedirect: '/pages/mall/admin/homePage/index',
taborPage: '',
testMode: true,
}
// delivery 沿用项目现有的本地 18000 配置来源,避免继续继承 consumer 的 9126 配置。
const deliveryProfile: RuntimeProfile = {
client: 'delivery',
supaUrl: 'http://192.168.1.62:18000',
supaKey: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vbiIsImlzcyI6InN1cGFiYXNlLTEiLCJpYXQiOjE3Njk2NzY0OTgsImV4cCI6MTkyNzM1NjQ5OH0.ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890',
wsUrl: 'ws://192.168.1.62:18000/realtime/v1/websocket',
pushServerUrl: 'http://192.168.1.62:7301',
homeRedirect: '/pages/mall/delivery/home/index',
taborPage: '/pages/mall/delivery/home/index',
testMode: true,
}
const fullProfile: RuntimeProfile = {
client: 'full',
supaUrl: consumerProfile.supaUrl,
supaKey: consumerProfile.supaKey,
wsUrl: consumerProfile.wsUrl,
pushServerUrl: consumerProfile.pushServerUrl,
homeRedirect: '/pages/main/index',
taborPage: '/pages/main/index',
testMode: true,
}
function resolveActiveProfile(client: string): RuntimeProfile {
if (client === 'merchant') {
return merchantProfile
}
if (client === 'admin') {
return adminProfile
}
if (client === 'delivery') {
return deliveryProfile
}
if (client === 'full') {
return fullProfile
}
return consumerProfile
}
const activeProfile = resolveActiveProfile(ACTIVE_CLIENT)
export const CURRENT_CLIENT: string = ACTIVE_CLIENT
export const APP_ROLE: string = CURRENT_CLIENT === 'full' ? 'consumer' : CURRENT_CLIENT
export const SUPA_URL: string = activeProfile.supaUrl
export const SUPA_KEY: string = activeProfile.supaKey
export const WS_URL: string = activeProfile.wsUrl
export const PUSH_SERVER_URL: string = activeProfile.pushServerUrl
export const HOME_REDIRECT: string = activeProfile.homeRedirect
export const TABORPAGE: string = activeProfile.taborPage
export const IS_TEST_MODE: boolean = activeProfile.testMode
export function logSupaConfig() {
const keyLen = SUPA_KEY.length
const masked = keyLen > 20
? SUPA_KEY.substring(0, 10) + '...' + SUPA_KEY.substring(keyLen - 8)
: '(too short)'
console.log('[consumer-db] 当前端类型:', CURRENT_CLIENT)
console.log('[consumer-db] 当前应用角色:', APP_ROLE)
console.log('[consumer-db] supabaseUrl 已加载:', SUPA_URL)
console.log('[consumer-db] supabaseKey 已加载:', masked)
}