Skip to content

Commit 8715274

Browse files
authored
adds ports to check environment variable.
Checks if the env PORTS_TO_CHECK is set, if so the string is split via "," to get an array of ports to check. If the env is not set, return the default commonly used ports.
1 parent 6ef6720 commit 8715274

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

api/ports.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,17 @@ import net from 'net';
22
import middleware from './_common/middleware.js';
33

44
// A list of commonly used ports.
5-
const PORTS = [
5+
const DEFAULT_PORTS_TO_CHECK = [
66
20, 21, 22, 23, 25, 53, 80, 67, 68, 69,
77
110, 119, 123, 143, 156, 161, 162, 179, 194,
88
389, 443, 587, 993, 995,
99
3000, 3306, 3389, 5060, 5900, 8000, 8080, 8888
1010
];
11+
/*
12+
* Checks if the env PORTS_TO_CHECK is set, if so the string is split via "," to get an array of ports to check.
13+
* If the env is not set, return the default commonly used ports.
14+
*/
15+
const PORTS = process.env.PORTS_TO_CHECK ? process.env.PORTS_TO_CHECK.split(",") : DEFAULT_PORTS_TO_CHECK
1116

1217
async function checkPort(port, domain) {
1318
return new Promise((resolve, reject) => {

0 commit comments

Comments
 (0)