通过ENV传递监听地址
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
PORT=3000
|
||||
HOST=0.0.0.0
|
||||
|
||||
# AWS S3 / MinIO Configuration
|
||||
AWS_REGION=us-east-1
|
||||
|
||||
@@ -10,6 +10,7 @@ dotenv.config();
|
||||
|
||||
const app = express();
|
||||
const PORT = process.env.PORT || 3000;
|
||||
const HOST = process.env.HOST || process.env.LISTEN_ADDRESS || '0.0.0.0';
|
||||
|
||||
app.use(cors());
|
||||
app.use(express.json());
|
||||
@@ -145,6 +146,6 @@ app.get('/api/status', (req, res) => {
|
||||
}
|
||||
});
|
||||
|
||||
app.listen(PORT, () => {
|
||||
console.log(`Server running on http://localhost:${PORT}`);
|
||||
app.listen(PORT, HOST, () => {
|
||||
console.log(`Server running on http://${HOST}:${PORT}`);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user