新增配置配件
This commit is contained in:
+13
-14
@@ -12,8 +12,6 @@ interface ApiConfig {
|
|||||||
documentUrl: string;
|
documentUrl: string;
|
||||||
// 文档上传API URL
|
// 文档上传API URL
|
||||||
uploadUrl: string;
|
uploadUrl: string;
|
||||||
// PostgREST URL (如果使用)
|
|
||||||
postgrestUrl?: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 不同环境的默认配置
|
// 不同环境的默认配置
|
||||||
@@ -27,16 +25,19 @@ const configs: Record<string, ApiConfig> = {
|
|||||||
|
|
||||||
// 测试环境
|
// 测试环境
|
||||||
testing: {
|
testing: {
|
||||||
baseUrl: 'http://172.18.0.100:3000',
|
baseUrl: 'http://nas.7bm.co:3000',
|
||||||
documentUrl: 'http://nas.7bm.co:9000/docauditai/',
|
documentUrl: 'http://nas.7bm.co:9000/docauditai/',
|
||||||
uploadUrl: 'http://172.16.0.58:8008/admin/documents/upload',
|
uploadUrl: 'http://172.16.0.58:8008/admin/documents/upload',
|
||||||
},
|
},
|
||||||
|
|
||||||
// 生产环境
|
// 生产环境
|
||||||
production: {
|
production: {
|
||||||
baseUrl: 'http://nas.7bm.co:3000',
|
// postgrest
|
||||||
documentUrl: 'http://nas.7bm.co:9000/docauditai/',
|
baseUrl: 'http://10.79.97.16:8000',
|
||||||
uploadUrl: 'http://172.16.0.58:8008/admin/documents/upload',
|
// 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 {
|
return {
|
||||||
baseUrl: process.env.NEXT_PUBLIC_API_BASE_URL || defaultConfig.baseUrl,
|
baseUrl: process.env.NEXT_PUBLIC_API_BASE_URL || defaultConfig.baseUrl,
|
||||||
documentUrl: process.env.NEXT_PUBLIC_DOCUMENT_URL || defaultConfig.documentUrl,
|
documentUrl: process.env.NEXT_PUBLIC_DOCUMENT_URL || defaultConfig.documentUrl,
|
||||||
uploadUrl: process.env.NEXT_PUBLIC_UPLOAD_URL || defaultConfig.uploadUrl,
|
uploadUrl: process.env.NEXT_PUBLIC_UPLOAD_URL || defaultConfig.uploadUrl
|
||||||
postgrestUrl: process.env.NEXT_PUBLIC_POSTGREST_URL || defaultConfig.postgrestUrl,
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -83,8 +83,7 @@ export const apiConfig = getCurrentConfig();
|
|||||||
export const {
|
export const {
|
||||||
baseUrl: API_BASE_URL,
|
baseUrl: API_BASE_URL,
|
||||||
documentUrl: DOCUMENT_URL,
|
documentUrl: DOCUMENT_URL,
|
||||||
uploadUrl: UPLOAD_URL,
|
uploadUrl: UPLOAD_URL
|
||||||
postgrestUrl: POSTGREST_URL
|
|
||||||
} = apiConfig;
|
} = apiConfig;
|
||||||
|
|
||||||
// 导出所有配置,供调试使用
|
// 导出所有配置,供调试使用
|
||||||
@@ -97,8 +96,8 @@ export const setEnvironment = (env: string): ApiConfig => {
|
|||||||
|
|
||||||
// 调试信息(仅在开发环境显示)
|
// 调试信息(仅在开发环境显示)
|
||||||
// if (process.env.NODE_ENV === 'development') {
|
// if (process.env.NODE_ENV === 'development') {
|
||||||
console.log('📦 API配置信息:', {
|
// console.log('📦 API配置信息:', {
|
||||||
environment: getCurrentEnvironment(),
|
// environment: getCurrentEnvironment(),
|
||||||
config: apiConfig
|
// config: apiConfig
|
||||||
});
|
// });
|
||||||
// }
|
// }
|
||||||
@@ -16,6 +16,10 @@ module.exports = {
|
|||||||
max_memory_restart: '1G',
|
max_memory_restart: '1G',
|
||||||
env: {
|
env: {
|
||||||
NODE_ENV: 'production',
|
NODE_ENV: 'production',
|
||||||
|
PORT: 51706,
|
||||||
|
},
|
||||||
|
env_testing: {
|
||||||
|
NODE_ENV: 'testing',
|
||||||
PORT: 51703,
|
PORT: 51703,
|
||||||
},
|
},
|
||||||
error_file: './logs/err.log',
|
error_file: './logs/err.log',
|
||||||
|
|||||||
+3
-1
@@ -5,10 +5,12 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "remix vite:build",
|
"build": "remix vite:build",
|
||||||
|
"build:test": "NODE_ENV=testing remix vite:build",
|
||||||
"dev": "remix vite:dev",
|
"dev": "remix vite:dev",
|
||||||
"lint": "eslint --ignore-path .gitignore --cache --cache-location ./node_modules/.cache/eslint .",
|
"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": "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"
|
"typecheck": "tsc"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
Reference in New Issue
Block a user