mirror of
https://github.com/HeyPuter/puter.git
synced 2025-02-02 22:43:45 +08: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
|
5
.gitignore
vendored
5
.gitignore
vendored
@ -5,4 +5,7 @@ node_modules/
|
|||||||
license.config.json
|
license.config.json
|
||||||
license-header.txt
|
license-header.txt
|
||||||
dist/
|
dist/
|
||||||
.vscode/
|
.vscode/
|
||||||
|
.env
|
||||||
|
# this is for jetbrain IDEs
|
||||||
|
.idea/
|
@ -2,9 +2,11 @@ const express = require("express");
|
|||||||
const { generateDevHtml, build } = require("./utils.js");
|
const { generateDevHtml, build } = require("./utils.js");
|
||||||
const { argv } = require('node:process');
|
const { argv } = require('node:process');
|
||||||
const chalk = require('chalk');
|
const chalk = require('chalk');
|
||||||
|
const dotenv = require('dotenv');
|
||||||
|
dotenv.config();
|
||||||
|
|
||||||
const app = express();
|
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 maxAttempts = 10; // Maximum number of ports to try
|
||||||
const env = argv[2] ?? "dev";
|
const env = argv[2] ?? "dev";
|
||||||
|
|
||||||
|
13
package-lock.json
generated
13
package-lock.json
generated
@ -11,6 +11,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"chalk": "^4.1.0",
|
"chalk": "^4.1.0",
|
||||||
"clean-css": "^5.3.2",
|
"clean-css": "^5.3.2",
|
||||||
|
"dotenv": "^16.4.5",
|
||||||
"express": "^4.18.2",
|
"express": "^4.18.2",
|
||||||
"html-entities": "^2.3.3",
|
"html-entities": "^2.3.3",
|
||||||
"nodemon": "^2.0.22",
|
"nodemon": "^2.0.22",
|
||||||
@ -781,6 +782,18 @@
|
|||||||
"npm": "1.2.8000 || >= 1.4.16"
|
"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": {
|
"node_modules/ee-first": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
|
||||||
|
@ -11,11 +11,12 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"chalk": "^4.1.0",
|
"chalk": "^4.1.0",
|
||||||
"clean-css": "^5.3.2",
|
"clean-css": "^5.3.2",
|
||||||
"html-entities": "^2.3.3",
|
"dotenv": "^16.4.5",
|
||||||
"webpack": "^5.88.2",
|
|
||||||
"express": "^4.18.2",
|
"express": "^4.18.2",
|
||||||
|
"html-entities": "^2.3.3",
|
||||||
"nodemon": "^2.0.22",
|
"nodemon": "^2.0.22",
|
||||||
"uglify-js": "^3.17.4",
|
"uglify-js": "^3.17.4",
|
||||||
|
"webpack": "^5.88.2",
|
||||||
"webpack-cli": "^5.1.1"
|
"webpack-cli": "^5.1.1"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
Loading…
Reference in New Issue
Block a user