mirror of
https://github.com/Discreetly/server.git
synced 2026-01-09 21:08:06 -05:00
fix PORT is necessary for heroku to host
This commit is contained in:
8
package-lock.json
generated
8
package-lock.json
generated
@@ -15,7 +15,7 @@
|
||||
"body-parser": "^1.20.2",
|
||||
"cors": "^2.8.5",
|
||||
"discreetly-claimcodes": "^1.1.3",
|
||||
"discreetly-interfaces": "^0.1.22",
|
||||
"discreetly-interfaces": "^0.1.23",
|
||||
"dotenv": "^16.3.1",
|
||||
"express": "^4.18.2",
|
||||
"express-basic-auth": "^1.2.1",
|
||||
@@ -1905,9 +1905,9 @@
|
||||
"integrity": "sha512-2QnlhYUPIGLl11XgxIxl6ZKIJZoS2T1ABIHbqjBbec0YYQ2qfWZ7JWH53OZm0mqeO8Dbjon5zK3YNoGiuYJ1Gg=="
|
||||
},
|
||||
"node_modules/discreetly-interfaces": {
|
||||
"version": "0.1.22",
|
||||
"resolved": "https://registry.npmjs.org/discreetly-interfaces/-/discreetly-interfaces-0.1.22.tgz",
|
||||
"integrity": "sha512-p7HuKOE0Zan3Nf3Rg6auzsxNeKrtH4GMRoSMhsb+6YGO9AlF6ffnlHV4L4SSxLbJr2XInGEf0TUzsKkXwkQKoQ==",
|
||||
"version": "0.1.23",
|
||||
"resolved": "https://registry.npmjs.org/discreetly-interfaces/-/discreetly-interfaces-0.1.23.tgz",
|
||||
"integrity": "sha512-C1mqzLZY52aW83XHUBr3lxe8F7HFagx4V+MzigxPf5GTjDGhelIbnmihhV3RUtWb1uddo1Gm1CImD+meygf1bg==",
|
||||
"dependencies": {
|
||||
"poseidon-lite": "^0.2.0",
|
||||
"rlnjs": "^3.1.4"
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
"body-parser": "^1.20.2",
|
||||
"cors": "^2.8.5",
|
||||
"discreetly-claimcodes": "^1.1.3",
|
||||
"discreetly-interfaces": "^0.1.22",
|
||||
"discreetly-interfaces": "^0.1.23",
|
||||
"dotenv": "^16.3.1",
|
||||
"express": "^4.18.2",
|
||||
"express-basic-auth": "^1.2.1",
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
import type { ServerI } from 'discreetly-interfaces';
|
||||
import 'dotenv/config';
|
||||
|
||||
// TODO THIS SHOULD BE AN ENVIRONMENTAL VARIABLE STORED IN .env FILE
|
||||
// IF THIS FILE DOESN'T EXIST, GENERATE A RANDOM ID AND STORE IT IN THE FILE
|
||||
let SERVER_ID: bigint;
|
||||
let PORT: string;
|
||||
let NAME: string;
|
||||
|
||||
try {
|
||||
@@ -14,12 +11,6 @@ try {
|
||||
}
|
||||
console.log('SERVERID:', SERVER_ID);
|
||||
|
||||
try {
|
||||
PORT = process.env.SERVER_PORT ? process.env.SERVER_PORT : '8000';
|
||||
} catch (err) {
|
||||
console.error('Error reading PORT from .env file!');
|
||||
}
|
||||
|
||||
try {
|
||||
NAME = process.env.SERVER_NAME ? process.env.SERVER_NAME : 'localhost';
|
||||
} catch (err) {
|
||||
@@ -29,7 +20,5 @@ try {
|
||||
export const serverConfig: ServerI = {
|
||||
id: SERVER_ID,
|
||||
name: NAME,
|
||||
serverInfoEndpoint: PORT,
|
||||
messageHandlerSocket: PORT,
|
||||
version: '0.0.1'
|
||||
version: '0.0.2'
|
||||
};
|
||||
|
||||
@@ -38,9 +38,9 @@ const adminAuth = basicAuth({
|
||||
});
|
||||
|
||||
function initAppListeners() {
|
||||
const serverPort = serverConfig.serverInfoEndpoint;
|
||||
const httpServer = http.createServer(app).listen(serverPort, () => {
|
||||
pp(`Server is running at port ${serverPort}`);
|
||||
const PORT = process.env.SERVER_PORT ? process.env.SERVER_PORT : '3001';
|
||||
const httpServer = http.createServer(app).listen(PORT, () => {
|
||||
pp(`Server is running at port ${PORT}`);
|
||||
});
|
||||
|
||||
const io = new SocketIOServer(httpServer);
|
||||
|
||||
Reference in New Issue
Block a user