diff --git a/src/modules/config.ts b/src/modules/config.ts index 0b910d5..73aa920 100644 --- a/src/modules/config.ts +++ b/src/modules/config.ts @@ -1,19 +1,12 @@ import { useConfig } from '@kevisual/use-config'; import { useFileStore } from '@kevisual/use-config'; import { minioResources } from './s3.ts'; +import { proxyDomain } from './domain.ts'; export const config = useConfig() as any; export const port = config.PORT ? Number(config.PORT) : 4005; export const fileStore = useFileStore('pages'); type ConfigType = { - api: { - /** - * API host address - */ - host: string; - path?: string; - port?: number; - }; apiList: { path: string; /** @@ -29,7 +22,11 @@ type ConfigType = { /** * self domain kevisual.xiongxiao.me */ - domain: string; + domain?: string; + /** + * self ip + */ + ip?: string; /** * resources path * https://minio.xiongxiao.me/resources @@ -41,24 +38,8 @@ type ConfigType = { */ allowedOrigin: string[]; }; - stat: { - /** - * 统计网站ID - */ - websiteId: string; - }; - redis?: { - host: string; - port: number; - password?: string; - }; }; export const myConfig: ConfigType = { - api: { - host: config.API_HOST, - path: config.API_PATH, - port: config.PROXY_PORT, - }, apiList: [ // { // path: '/api', @@ -66,20 +47,12 @@ export const myConfig: ConfigType = { // }, { path: '/client', - target: config.API_CLIENT_HOST || 'http://localhost:51015', + target: config.API_CLIENT_HOST || 'http://localhost:51515', }, ], proxy: { - domain: config.PROXY_DOMAIN, + domain: proxyDomain as string, resources: minioResources, allowedOrigin: (config.PROXY_ALLOWED_ORIGINS as string)?.split(',') || [], - }, - redis: { - host: config.REDIS_HOST, - port: config.REDIS_PORT, - password: config.REDIS_PASSWORD, - }, - stat: { - websiteId: config.DATA_WEBSITE_ID, - }, + } }; diff --git a/src/modules/domain.ts b/src/modules/domain.ts index c82171b..41bdcdc 100644 --- a/src/modules/domain.ts +++ b/src/modules/domain.ts @@ -1,5 +1,7 @@ +import { useKey } from "@kevisual/use-config"; + /** * 用来放cookie的域名 */ -export const domain = process.env.DOMAIN || ''; // 请在这里填写你的域名 +export const proxyDomain = useKey('PROXY_DOMAIN') || ''; // 请在这里填写你的域名 diff --git a/src/routes/user/me.ts b/src/routes/user/me.ts index c8a6618..07179c9 100644 --- a/src/routes/user/me.ts +++ b/src/routes/user/me.ts @@ -1,7 +1,7 @@ import { app } from '@/app.ts'; import { Org } from '@/models/org.ts'; import { User } from '@/models/user.ts'; -import { domain } from '@/modules/domain.ts'; +import { proxyDomain as domain } from '@/modules/domain.ts'; /** * 当配置了domain后,创建cookie,当get请求地址的时候,会自动带上cookie * @param token