add support to disable the key
All checks were successful
Docker build image / build (push) Successful in 33s
All checks were successful
Docker build image / build (push) Successful in 33s
This commit is contained in:
parent
a015576902
commit
c1417a6913
1 changed files with 7 additions and 0 deletions
7
index.js
7
index.js
|
@ -6,6 +6,7 @@ const http = require('http');
|
||||||
const port = env.PORT || "3000"
|
const port = env.PORT || "3000"
|
||||||
const address = env.ADDRESS || "0.0.0.0"
|
const address = env.ADDRESS || "0.0.0.0"
|
||||||
const key = env.KEY
|
const key = env.KEY
|
||||||
|
const nokey = env.USE_KEY || "false"
|
||||||
|
|
||||||
let tokens = {};
|
let tokens = {};
|
||||||
|
|
||||||
|
@ -49,6 +50,12 @@ const server = http.Server(async (req, res) => {
|
||||||
visitorData: tokens.visitorData,
|
visitorData: tokens.visitorData,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (nokey) {
|
||||||
|
res.writeHead(200, { 'Content-Type': 'application/json' });
|
||||||
|
res.write(JSON.stringify(json));
|
||||||
|
return res.end();
|
||||||
|
}
|
||||||
|
|
||||||
if (host === `127.0.0.1:${port}` || host === `localhost:${port}`) {
|
if (host === `127.0.0.1:${port}` || host === `localhost:${port}`) {
|
||||||
res.writeHead(200, { 'Content-Type': 'application/json' });
|
res.writeHead(200, { 'Content-Type': 'application/json' });
|
||||||
res.write(JSON.stringify(json));
|
res.write(JSON.stringify(json));
|
||||||
|
|
Loading…
Add table
Reference in a new issue