let pm2 use .env
This commit is contained in:
parent
4660da4631
commit
ab3593c77a
2
.gitignore
vendored
2
.gitignore
vendored
@ -42,3 +42,5 @@ yarn-error.log*
|
||||
next-env.d.ts
|
||||
|
||||
/app/generated/prisma
|
||||
|
||||
logs
|
||||
@ -1,22 +1,46 @@
|
||||
const path = require('path')
|
||||
const dotenv = require('dotenv')
|
||||
|
||||
// 加载 .env 文件
|
||||
const envConfig = dotenv.config({ path: path.resolve(__dirname, '.env') })
|
||||
|
||||
if (envConfig.error) {
|
||||
console.error('Error loading .env file:', envConfig.error)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
apps: [
|
||||
{
|
||||
name: "WinupdateNeo",
|
||||
script: "bun",
|
||||
args: "start",
|
||||
cwd: "./",
|
||||
instances: 1,
|
||||
autorestart: true,
|
||||
watch: false,
|
||||
max_memory_restart: "1G",
|
||||
name: 'winupdate-neo',
|
||||
script: 'bun',
|
||||
args: 'run start',
|
||||
cwd: __dirname,
|
||||
env: {
|
||||
NODE_ENV: "production",
|
||||
PORT: 3000
|
||||
...process.env,
|
||||
// 显式设置关键环境变量
|
||||
NODE_ENV: 'production',
|
||||
PORT: process.env.PORT || '12398',
|
||||
DATABASE_URL: process.env.DATABASE_URL,
|
||||
AUTH_USERNAME: process.env.AUTH_USERNAME,
|
||||
AUTH_PASSWORD: process.env.AUTH_PASSWORD,
|
||||
MINIO_ENDPOINT: process.env.MINIO_ENDPOINT,
|
||||
MINIO_PORT: process.env.MINIO_PORT,
|
||||
MINIO_USE_SSL: process.env.MINIO_USE_SSL,
|
||||
MINIO_ACCESS_KEY: process.env.MINIO_ACCESS_KEY,
|
||||
MINIO_SECRET_KEY: process.env.MINIO_SECRET_KEY,
|
||||
MINIO_BUCKET_NAME: process.env.MINIO_BUCKET_NAME
|
||||
},
|
||||
env_development: {
|
||||
NODE_ENV: "development",
|
||||
PORT: 3000
|
||||
}
|
||||
instances: 1,
|
||||
exec_mode: 'fork',
|
||||
watch: false,
|
||||
max_memory_restart: '1G',
|
||||
error_file: './logs/err.log',
|
||||
out_file: './logs/out.log',
|
||||
log_file: './logs/combined.log',
|
||||
time: true,
|
||||
autorestart: true,
|
||||
max_restarts: 10,
|
||||
min_uptime: '10s'
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user