@vandenberghinc/volt 1.1.8 → 1.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/backend/src/server.ts +27 -30
- package/package.json +1 -1
package/backend/src/server.ts
CHANGED
|
@@ -769,6 +769,7 @@ export class Server {
|
|
|
769
769
|
// Instance properties
|
|
770
770
|
public ip: string;
|
|
771
771
|
public port: number;
|
|
772
|
+
public https_port: number;
|
|
772
773
|
public domain: string;
|
|
773
774
|
public full_domain: string;
|
|
774
775
|
public source: vlib.Path; // vlib.Path type
|
|
@@ -781,7 +782,7 @@ export class Server {
|
|
|
781
782
|
public token_expiration: number;
|
|
782
783
|
public google_tag?: string;
|
|
783
784
|
public production: boolean;
|
|
784
|
-
public localhost: boolean;
|
|
785
|
+
// public localhost: boolean;
|
|
785
786
|
public multiprocessing: boolean;
|
|
786
787
|
public processes: number;
|
|
787
788
|
public company: CompanyInfo;
|
|
@@ -833,7 +834,7 @@ export class Server {
|
|
|
833
834
|
|
|
834
835
|
constructor({
|
|
835
836
|
ip, // leave undefined for blank detection.
|
|
836
|
-
port
|
|
837
|
+
port, // leave undefined for blank detection.
|
|
837
838
|
domain,
|
|
838
839
|
is_primary = true,
|
|
839
840
|
source,
|
|
@@ -878,7 +879,7 @@ export class Server {
|
|
|
878
879
|
enable_account_activation = true,
|
|
879
880
|
// honey_pot_key = null,
|
|
880
881
|
production = false,
|
|
881
|
-
localhost = true,
|
|
882
|
+
// localhost = true,
|
|
882
883
|
multiprocessing = true,
|
|
883
884
|
processes = null,
|
|
884
885
|
// file_watcher = false,
|
|
@@ -920,7 +921,7 @@ export class Server {
|
|
|
920
921
|
enable_account_activation?: boolean;
|
|
921
922
|
// honey_pot_key?: string | null;
|
|
922
923
|
production?: boolean;
|
|
923
|
-
localhost?: boolean;
|
|
924
|
+
// localhost?: boolean;
|
|
924
925
|
multiprocessing?: boolean;
|
|
925
926
|
processes?: number | null;
|
|
926
927
|
// file_watcher?: FileWatcher | Record<string, any> | boolean;
|
|
@@ -1057,7 +1058,7 @@ export class Server {
|
|
|
1057
1058
|
enable_2fa: {type: "boolean", required: false},
|
|
1058
1059
|
enable_account_activation: {type: "boolean", required: false},
|
|
1059
1060
|
production: {type: "boolean", required: false},
|
|
1060
|
-
localhost: { type: "boolean", required: false },
|
|
1061
|
+
// localhost: { type: "boolean", required: false },
|
|
1061
1062
|
multiprocessing: {type: "boolean", required: false, default: true},
|
|
1062
1063
|
processes: {type: "number", required: false, default: null},
|
|
1063
1064
|
// file_watcher: {type: ["null", "boolean", "object", FileWatcher], required: false},
|
|
@@ -1085,7 +1086,13 @@ export class Server {
|
|
|
1085
1086
|
}});
|
|
1086
1087
|
|
|
1087
1088
|
// Assign attributes directly.
|
|
1088
|
-
|
|
1089
|
+
if (production || port == null) {
|
|
1090
|
+
this.port = 80;
|
|
1091
|
+
this.https_port = 443;
|
|
1092
|
+
} else {
|
|
1093
|
+
this.port = port;
|
|
1094
|
+
this.https_port = port + 1;
|
|
1095
|
+
}
|
|
1089
1096
|
this.ip = ip ?? "127.0.0.1";
|
|
1090
1097
|
this.is_primary = is_primary && libcluster.isPrimary;
|
|
1091
1098
|
this.source = new vlib.Path(source);
|
|
@@ -1095,7 +1102,7 @@ export class Server {
|
|
|
1095
1102
|
this.token_expiration = token_expiration;
|
|
1096
1103
|
this.google_tag = google_tag;
|
|
1097
1104
|
this.production = production;
|
|
1098
|
-
this.localhost = localhost;
|
|
1105
|
+
// this.localhost = localhost;
|
|
1099
1106
|
this.lightweight = lightweight;
|
|
1100
1107
|
this.multiprocessing = multiprocessing;
|
|
1101
1108
|
this.processes = processes == null ? os.cpus().length : processes;
|
|
@@ -1115,13 +1122,13 @@ export class Server {
|
|
|
1115
1122
|
this.err_endpoints = new Map();
|
|
1116
1123
|
|
|
1117
1124
|
// Assign based on localhost.
|
|
1118
|
-
if (localhost) {
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
} else if (!localhost && ip == null) { // use argument ip not attr since that already has a default.
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
}
|
|
1125
|
+
// if (localhost) {
|
|
1126
|
+
// this.ip = "127.0.0.1";
|
|
1127
|
+
// this.domain = this.ip + ":" + (port + (this.tls ? 1 : 0));
|
|
1128
|
+
// } else if (!production && !localhost && ip == null) { // use argument ip not attr since that already has a default.
|
|
1129
|
+
// this.ip = vlib.Network.private_ip();
|
|
1130
|
+
// this.domain = this.ip + ":" + (port + (this.tls ? 1 : 0));
|
|
1131
|
+
// }
|
|
1125
1132
|
|
|
1126
1133
|
/* @performance */ this.performance = new vlib.Performance("Server performance");
|
|
1127
1134
|
|
|
@@ -1505,10 +1512,10 @@ export class Server {
|
|
|
1505
1512
|
const status: Record<string, any> = {};
|
|
1506
1513
|
status.ip = this.ip;
|
|
1507
1514
|
if (this.http) {
|
|
1508
|
-
status.http_port = this.port
|
|
1515
|
+
status.http_port = this.port;
|
|
1509
1516
|
}
|
|
1510
1517
|
if (this.https) {
|
|
1511
|
-
status.https_port = this.
|
|
1518
|
+
status.https_port = this.https_port;
|
|
1512
1519
|
}
|
|
1513
1520
|
|
|
1514
1521
|
// Load data.
|
|
@@ -2537,25 +2544,15 @@ export class Server {
|
|
|
2537
2544
|
// worker.start();
|
|
2538
2545
|
// }
|
|
2539
2546
|
|
|
2540
|
-
// Set default port.
|
|
2541
|
-
let http_port: number, https_port: number;
|
|
2542
|
-
if (this.port == null) {
|
|
2543
|
-
http_port = 80;
|
|
2544
|
-
https_port = 443;
|
|
2545
|
-
} else {
|
|
2546
|
-
http_port = this.port;
|
|
2547
|
-
https_port = this.port + 1;
|
|
2548
|
-
}
|
|
2549
|
-
|
|
2550
2547
|
// Callbacks.
|
|
2551
2548
|
let is_running = false;
|
|
2552
2549
|
const on_running = () => {
|
|
2553
2550
|
if (!is_running) {
|
|
2554
2551
|
is_running = true;
|
|
2555
2552
|
if (this.https !== undefined) {
|
|
2556
|
-
logger.log(0, log_source, `Running on http://${this.ip}:${
|
|
2553
|
+
logger.log(0, log_source, `Running on http://${this.ip}:${this.port} and https://${this.ip}:${this.https_port}.`);
|
|
2557
2554
|
} else {
|
|
2558
|
-
logger.log(0, log_source, `Running on http://${this.ip}:${
|
|
2555
|
+
logger.log(0, log_source, `Running on http://${this.ip}:${this.port}.`);
|
|
2559
2556
|
}
|
|
2560
2557
|
}
|
|
2561
2558
|
};
|
|
@@ -2578,10 +2575,10 @@ export class Server {
|
|
|
2578
2575
|
};
|
|
2579
2576
|
|
|
2580
2577
|
// Listen.
|
|
2581
|
-
this.http.listen(
|
|
2578
|
+
this.http.listen(this.port, this.ip, on_running);
|
|
2582
2579
|
this.http.on("error", on_error);
|
|
2583
2580
|
if (this.https !== undefined) {
|
|
2584
|
-
this.https.listen(https_port, this.ip, on_running);
|
|
2581
|
+
this.https.listen(this.https_port, this.ip, on_running);
|
|
2585
2582
|
this.https.on("error", on_error);
|
|
2586
2583
|
}
|
|
2587
2584
|
|