change backend PORT to BACKEND_PORT and front-3000 to 3002
This commit is contained in:
+3
-3
@@ -37,8 +37,8 @@ This is the backend server for PrivyDrop. It is built with Node.js, Express, and
|
||||
|
||||
```ini
|
||||
# Server Configuration
|
||||
PORT=3001
|
||||
CORS_ORIGIN=http://localhost:3000 # URL of the frontend development server
|
||||
BACKEND_PORT=3001
|
||||
CORS_ORIGIN=http://localhost:3002 # URL of the frontend development server
|
||||
|
||||
# Redis Configuration
|
||||
REDIS_HOST=127.0.0.1
|
||||
@@ -50,7 +50,7 @@ This is the backend server for PrivyDrop. It is built with Node.js, Express, and
|
||||
```bash
|
||||
npm run dev
|
||||
```
|
||||
The server will start on the port specified by the `PORT` environment variable (defaults to 3001).
|
||||
The server will start on the port specified by the `BACKEND_PORT` environment variable (defaults to 3001).
|
||||
|
||||
## 📖 API & Event Summary
|
||||
|
||||
|
||||
@@ -37,8 +37,8 @@
|
||||
|
||||
```ini
|
||||
# 服务器配置
|
||||
PORT=3001
|
||||
CORS_ORIGIN=http://localhost:3000 # 前端开发服务器的 URL
|
||||
BACKEND_PORT=3001
|
||||
CORS_ORIGIN=http://localhost:3002 # 前端开发服务器的 URL
|
||||
|
||||
# Redis 配置
|
||||
REDIS_HOST=127.0.0.1
|
||||
@@ -50,7 +50,7 @@
|
||||
```bash
|
||||
npm run dev
|
||||
```
|
||||
服务器将在 `PORT` 环境变量指定的端口上启动(默认为 3001)。
|
||||
服务器将在 `BACKEND_PORT` 环境变量指定的端口上启动(默认为 3001)。
|
||||
|
||||
## 📖 API 与事件摘要
|
||||
|
||||
|
||||
+18
-16
@@ -1,18 +1,20 @@
|
||||
module.exports = {
|
||||
apps: [{
|
||||
name: "signaling-server",
|
||||
script: "./dist/server.js", // Point to the compiled file
|
||||
watch: false,
|
||||
env: {
|
||||
"NODE_ENV": "production",
|
||||
"PORT": 3001
|
||||
apps: [
|
||||
{
|
||||
name: "signaling-server",
|
||||
script: "./dist/server.js", // Point to the compiled file
|
||||
watch: false,
|
||||
env: {
|
||||
NODE_ENV: "production",
|
||||
BACKEND_PORT: 3001,
|
||||
},
|
||||
log_date_format: "YYYY-MM-DD HH:mm:ss",
|
||||
error_file: "/var/log/signaling-server-error.log",
|
||||
out_file: "/var/log/signaling-server-out.log",
|
||||
max_memory_restart: "500M",
|
||||
instances: 1,
|
||||
exec_mode: "fork",
|
||||
group: "ssl-cert", // Add this line to specify the group the process runs as
|
||||
},
|
||||
log_date_format: "YYYY-MM-DD HH:mm:ss",
|
||||
error_file: "/var/log/signaling-server-error.log",
|
||||
out_file: "/var/log/signaling-server-out.log",
|
||||
max_memory_restart: "500M",
|
||||
instances: 1,
|
||||
exec_mode: "fork",
|
||||
group: "ssl-cert" // Add this line to specify the group the process runs as
|
||||
}]
|
||||
}
|
||||
],
|
||||
};
|
||||
|
||||
@@ -3,7 +3,7 @@ import path from "path";
|
||||
|
||||
// Define the type for the configuration object
|
||||
interface AppConfig {
|
||||
PORT: number;
|
||||
BACKEND_PORT: number;
|
||||
CORS_ORIGIN: string;
|
||||
NODE_ENV: "development" | "production";
|
||||
REDIS: {
|
||||
@@ -30,7 +30,7 @@ if (!process.env.REDIS_PORT) {
|
||||
}
|
||||
// Export the type-safe configuration object
|
||||
export const CONFIG: AppConfig = {
|
||||
PORT: parseInt(process.env.BACKEND_PORT || "3001", 10),
|
||||
BACKEND_PORT: parseInt(process.env.BACKEND_PORT || "3001", 10),
|
||||
CORS_ORIGIN: process.env.CORS_ORIGIN!,
|
||||
NODE_ENV:
|
||||
(process.env.NODE_ENV as "development" | "production") || "development",
|
||||
|
||||
@@ -17,8 +17,8 @@ const server = http.createServer(app);
|
||||
const io = new Server(server, { cors: corsWSOptions });
|
||||
setupSocketHandlers(io);
|
||||
|
||||
server.listen(CONFIG.PORT, () => {
|
||||
server.listen(CONFIG.BACKEND_PORT, () => {
|
||||
console.log(
|
||||
`Signaling server running in ${CONFIG.NODE_ENV} mode on port ${CONFIG.PORT}`
|
||||
`Signaling server running in ${CONFIG.NODE_ENV} mode on port ${CONFIG.BACKEND_PORT}`
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user