From e305a298742b2256c0d80759573a2475cd54f40b Mon Sep 17 00:00:00 2001 From: Cefatus Date: Fri, 20 Jan 2023 18:16:09 +0700 Subject: [PATCH] add path config Use `_path` to control path instead of hardcode. So it's easier to config. --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 20425cb..a2fb85e 100644 --- a/index.js +++ b/index.js @@ -5,6 +5,7 @@ var url = require('url'); var secret = 'amazingkey'; // secret key of the webhook var port = 8081; // port +var _path = '/git'; function resHeadJson(res,code){ var value = {"Content-Type": "application/json"}; @@ -19,7 +20,7 @@ http.createServer(function(req, res){ console.log("request received at: ",path); - if(path!='/push' || req.method != 'POST'){ + if(path!=_path || req.method != 'POST'){ var data = JSON.stringify({"error": "invalid request"}); resHeadJson(res,400); return res.end(data);