Repository navigation
v0.3.0
What's New
PM2 Environment Variable Injection
You can now inject environment variables when PM2 starts or reloads:
pm2: {
appName: "myapp",
env: {
NODE_ENV: "production",
API_BASE_URL: process.env.API_BASE_URL,
DATABASE_URL: process.env.DATABASE_URL,
},
}How it works:
- Environment variables are passed via shell environment
- Windows:
set VAR=val && pm2 reload app - Linux:
VAR=val pm2 reload app - Variables persist after
pm2 save
Use case: Deploy from GitHub Actions with secrets:
env:
API_BASE_URL: ${{ secrets.API_BASE_URL }}The config reads process.env.API_BASE_URL and injects it to PM2.
Other Changes
- Added
escapeShellValue()for safe command execution - Dry-run now shows env variable count
- Updated documentation and example config