-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdiscovery.js
28 lines (25 loc) · 938 Bytes
/
discovery.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
(function () {
const request = require("request");
const os = require("os");
const common = require("./services/common.js");
function submit() {
try {
var serviceUrl = "http://" + common.findLANAddress() + ":12002/static/app.xhtml";
var host = os.hostname();
var url = "http://evolus.vn/d/post?id=theater&ip=" + escape(serviceUrl) + "&extra_host=" + escape(host);
request(url, function (error, response, body) {
if (!response || response.statusCode != 200) {
console.error(new Error("Invalid discovery response"));
return;
}
console.log("DISCOVERY DATA SUBMITTED.");
console.log("SERVICE URL: " + serviceUrl);
});
} finally {
setTimeout(submit, 60000);
}
}
module.exports = {
start: submit
};
})();