新增配置配件

This commit is contained in:
2025-06-10 10:04:55 +08:00
parent 534e1ba153
commit eef41c1fa4
3 changed files with 20 additions and 15 deletions
+13 -14
View File
@@ -12,8 +12,6 @@ interface ApiConfig {
documentUrl: string;
// 文档上传API URL
uploadUrl: string;
// PostgREST URL (如果使用)
postgrestUrl?: string;
}
// 不同环境的默认配置
@@ -27,16 +25,19 @@ const configs: Record<string, ApiConfig> = {
// 测试环境
testing: {
baseUrl: 'http://172.18.0.100:3000',
baseUrl: 'http://nas.7bm.co:3000',
documentUrl: 'http://nas.7bm.co:9000/docauditai/',
uploadUrl: 'http://172.16.0.58:8008/admin/documents/upload',
},
// 生产环境
production: {
baseUrl: 'http://nas.7bm.co:3000',
documentUrl: 'http://nas.7bm.co:9000/docauditai/',
uploadUrl: 'http://172.16.0.58:8008/admin/documents/upload',
// postgrest
baseUrl: 'http://10.79.97.16:8000',
// minio
documentUrl: 'http://10.76.244.156:9001/docauditai/',
// 文件上传
uploadUrl: 'http://10.79.97.16:8000/admin/documents/upload',
},
// 备用配置 (可以根据需要添加更多环境)
@@ -58,8 +59,7 @@ const getConfigFromEnv = (defaultConfig: ApiConfig): ApiConfig => {
return {
baseUrl: process.env.NEXT_PUBLIC_API_BASE_URL || defaultConfig.baseUrl,
documentUrl: process.env.NEXT_PUBLIC_DOCUMENT_URL || defaultConfig.documentUrl,
uploadUrl: process.env.NEXT_PUBLIC_UPLOAD_URL || defaultConfig.uploadUrl,
postgrestUrl: process.env.NEXT_PUBLIC_POSTGREST_URL || defaultConfig.postgrestUrl,
uploadUrl: process.env.NEXT_PUBLIC_UPLOAD_URL || defaultConfig.uploadUrl
};
};
@@ -83,8 +83,7 @@ export const apiConfig = getCurrentConfig();
export const {
baseUrl: API_BASE_URL,
documentUrl: DOCUMENT_URL,
uploadUrl: UPLOAD_URL,
postgrestUrl: POSTGREST_URL
uploadUrl: UPLOAD_URL
} = apiConfig;
// 导出所有配置,供调试使用
@@ -97,8 +96,8 @@ export const setEnvironment = (env: string): ApiConfig => {
// 调试信息(仅在开发环境显示)
// if (process.env.NODE_ENV === 'development') {
console.log('📦 API配置信息:', {
environment: getCurrentEnvironment(),
config: apiConfig
});
// console.log('📦 API配置信息:', {
// environment: getCurrentEnvironment(),
// config: apiConfig
// });
// }
+4
View File
@@ -16,6 +16,10 @@ module.exports = {
max_memory_restart: '1G',
env: {
NODE_ENV: 'production',
PORT: 51706,
},
env_testing: {
NODE_ENV: 'testing',
PORT: 51703,
},
error_file: './logs/err.log',
+3 -1
View File
@@ -5,10 +5,12 @@
"type": "module",
"scripts": {
"build": "remix vite:build",
"build:test": "NODE_ENV=testing remix vite:build",
"dev": "remix vite:dev",
"lint": "eslint --ignore-path .gitignore --cache --cache-location ./node_modules/.cache/eslint .",
"start": "node -r dotenv/config ./node_modules/.bin/remix-serve ./build/server/index.js",
"start:pm2": "pm2 start ecosystem.config.cjs",
"start:pm2": "npm run build && pm2 start ecosystem.config.cjs",
"start:pm2:test": "npm run build:test && pm2 start ecosystem.config.cjs --env testing",
"typecheck": "tsc"
},
"dependencies": {