mirror of
https://github.com/HeyPuter/puter
synced 2024-11-14 22:06:00 +00:00
Implement .env support for PORT property
This commit is contained in:
parent
e030321da0
commit
06fc54b18e
1
.env.example
Normal file
1
.env.example
Normal file
@ -0,0 +1 @@
|
||||
PORT=4000
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -6,3 +6,6 @@ license.config.json
|
||||
license-header.txt
|
||||
dist/
|
||||
.vscode/
|
||||
.env
|
||||
# this is for jetbrain IDEs
|
||||
.idea/
|
@ -2,9 +2,11 @@ const express = require("express");
|
||||
const { generateDevHtml, build } = require("./utils.js");
|
||||
const { argv } = require('node:process');
|
||||
const chalk = require('chalk');
|
||||
const dotenv = require('dotenv');
|
||||
dotenv.config();
|
||||
|
||||
const app = express();
|
||||
let port = 4000; // Starting port
|
||||
let port = process.env.PORT ?? 4000; // Starting port
|
||||
const maxAttempts = 10; // Maximum number of ports to try
|
||||
const env = argv[2] ?? "dev";
|
||||
|
||||
|
13
package-lock.json
generated
13
package-lock.json
generated
@ -11,6 +11,7 @@
|
||||
"devDependencies": {
|
||||
"chalk": "^4.1.0",
|
||||
"clean-css": "^5.3.2",
|
||||
"dotenv": "^16.4.5",
|
||||
"express": "^4.18.2",
|
||||
"html-entities": "^2.3.3",
|
||||
"nodemon": "^2.0.22",
|
||||
@ -781,6 +782,18 @@
|
||||
"npm": "1.2.8000 || >= 1.4.16"
|
||||
}
|
||||
},
|
||||
"node_modules/dotenv": {
|
||||
"version": "16.4.5",
|
||||
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz",
|
||||
"integrity": "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://dotenvx.com"
|
||||
}
|
||||
},
|
||||
"node_modules/ee-first": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
|
||||
|
@ -11,11 +11,12 @@
|
||||
"devDependencies": {
|
||||
"chalk": "^4.1.0",
|
||||
"clean-css": "^5.3.2",
|
||||
"html-entities": "^2.3.3",
|
||||
"webpack": "^5.88.2",
|
||||
"dotenv": "^16.4.5",
|
||||
"express": "^4.18.2",
|
||||
"html-entities": "^2.3.3",
|
||||
"nodemon": "^2.0.22",
|
||||
"uglify-js": "^3.17.4",
|
||||
"webpack": "^5.88.2",
|
||||
"webpack-cli": "^5.1.1"
|
||||
},
|
||||
"scripts": {
|
||||
|
Loading…
Reference in New Issue
Block a user