Commit 451319e4 authored by nilanjandaw's avatar nilanjandaw

decoupled constants

parent b7908d29
{
"mqtt_url": "10.129.6.5",
"registry_url" :"10.129.6.5:5000/",
"master_port": 8080,
"master_address": "10.129.6.5"
}
\ No newline at end of file
'use strict';
const mqtt = require('mqtt') const mqtt = require('mqtt')
const client = mqtt.connect('mqtt://localhost') const constants = require(".././constants.json")
console.log(constants.mqtt_url);
const client = mqtt.connect('mqtt://' + constants.mqtt_url)
const libSupport = require('./lib') const libSupport = require('./lib')
const execute = require('./execute') const execute = require('./execute')
const fs = require('fs') const fs = require('fs')
const node_id = "20sez54hq8" const node_id = "20sez54hq8"
const local_repository = __dirname + "/local_repository/" const local_repository = __dirname + "/local_repository/"
const host_url = 'http://127.0.0.1:8080/' const host_url = "http://" + constants.master_address + ":" + constants.master_port
client.on('connect', function () { client.on('connect', function () {
client.subscribe(node_id, function (err) { client.subscribe(node_id, function (err) {
if (!err) { if (!err) {
......
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
const express = require('express') const express = require('express')
const bodyParser = require('body-parser') const bodyParser = require('body-parser')
const fileUpload = require('express-fileupload'); const fileUpload = require('express-fileupload');
const constants = require('.././constants.json')
const fs = require('fs') const fs = require('fs')
const { spawn } = require('child_process'); const { spawn } = require('child_process');
const morgan = require('morgan') const morgan = require('morgan')
const mqtt = require('mqtt') const mqtt = require('mqtt')
const client = mqtt.connect('mqtt://localhost') const client = mqtt.connect('mqtt://' + constants.mqtt_url)
const app = express() const app = express()
const libSupport = require('./lib') const libSupport = require('./lib')
...@@ -26,7 +26,7 @@ let requestQueue = [] ...@@ -26,7 +26,7 @@ let requestQueue = []
const node_id = "20sez54hq8" const node_id = "20sez54hq8"
const WINDOW_SIZE = 10 const WINDOW_SIZE = 10
const port = 8080 const port = 8080
const registry_url = "10.129.6.5:5000/" const registry_url = constants.registry_url
app.post('/serverless/deploy', (req, res) => { app.post('/serverless/deploy', (req, res) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment