代理配置和说明
This commit is contained in:
+1
-1
@@ -3,7 +3,7 @@ const proxyConfig = {
|
||||
// 系统代理配置
|
||||
system: {
|
||||
host: '127.0.0.1',
|
||||
port: 7897,
|
||||
port: process.env.PROXY_PORT ? parseInt(process.env.PROXY_PORT) : 7890,
|
||||
protocol: 'http'
|
||||
},
|
||||
|
||||
|
||||
@@ -6,9 +6,34 @@
|
||||
|
||||
const PixivServer = require('./server');
|
||||
|
||||
// 解析命令行参数
|
||||
function parseArguments() {
|
||||
const args = process.argv.slice(2);
|
||||
const options = {};
|
||||
|
||||
for (let i = 0; i < args.length; i++) {
|
||||
const arg = args[i];
|
||||
if (arg === '--proxy-port' && i + 1 < args.length) {
|
||||
options.proxyPort = parseInt(args[i + 1]);
|
||||
i++; // 跳过下一个参数
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
// 获取命令行参数
|
||||
const cliOptions = parseArguments();
|
||||
|
||||
// 设置环境变量
|
||||
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
|
||||
|
||||
// 如果提供了代理端口,设置环境变量
|
||||
if (cliOptions.proxyPort) {
|
||||
process.env.PROXY_PORT = cliOptions.proxyPort.toString();
|
||||
console.log(`📡 代理端口已设置为: ${cliOptions.proxyPort}`);
|
||||
}
|
||||
|
||||
console.log('🚀 启动 Pixiv 后端服务器...');
|
||||
console.log(`📊 环境: ${process.env.NODE_ENV}`);
|
||||
console.log(`🌐 端口: ${process.env.PORT || 3000}`);
|
||||
|
||||
Reference in New Issue
Block a user