Compare View
Commits (5)
Changes
Showing 3 changed files Side-by-side Diff
gateway/pull.js
heartbeat.js
... | ... | @@ -6,16 +6,19 @@ const config = require('./config'); |
6 | 6 | const logger = require('./logger'); |
7 | 7 | const matrix = require('./matrix'); |
8 | 8 | |
9 | +let module_type; | |
10 | + | |
9 | 11 | function sendHeartbeat() { |
10 | - if (!config || !config.core_url) { return; } | |
12 | + if (!config || !config.core_url || !module_type) { return; } | |
11 | 13 | |
12 | 14 | const requestOptions = { |
13 | - url: config.core_url + '/heartbeats', | |
14 | - form: { | |
15 | + uri: config.core_url + '/heartbeats', | |
16 | + method: 'POST', | |
17 | + json: { | |
15 | 18 | name: config.handler_name, |
16 | - module_type: 'gateway', | |
17 | - config: JSON.stringify(config), | |
18 | - matrix: JSON.stringify(matrix) | |
19 | + module_type: module_type, | |
20 | + config: config, | |
21 | + matrix: matrix | |
19 | 22 | } |
20 | 23 | } |
21 | 24 | |
... | ... | @@ -27,3 +30,9 @@ setInterval( |
27 | 30 | sendHeartbeat, |
28 | 31 | 60 * 1000 |
29 | 32 | ) |
33 | + | |
34 | +function setModuleType(value) { | |
35 | + module_type = value; | |
36 | +} | |
37 | + | |
38 | +exports.setModuleType = setModuleType; |