Generating the correct URL for service models
Change-Id: I2b004176b74043f46ee96b0bad4f0659422836da
diff --git a/conf/browsersync.conf.js b/conf/browsersync.conf.js
index d820bb6..391f688 100644
--- a/conf/browsersync.conf.js
+++ b/conf/browsersync.conf.js
@@ -10,12 +10,12 @@
conf.paths.src
],
middleware: function(req, res, next){
- if (req.url.indexOf('xosapi') !== -1) {
+ if (req.url.indexOf('xosapi') !== -1 || req.url.indexOf('socket.io') !== -1) {
proxy.web(req, res);
}
- // else if (req.url.indexOf('extensions') !== -1) {
- // extensionsProxy.web(req, res);
- // }
+ else if (req.url.indexOf('extensions') !== -1) {
+ extensionsProxy.web(req, res);
+ }
else{
next();
}
diff --git a/conf/proxy.js b/conf/proxy.js
index fedbf72..d2459d8 100644
--- a/conf/proxy.js
+++ b/conf/proxy.js
@@ -1,11 +1,13 @@
const httpProxy = require('http-proxy');
+const target = process.env.PROXY || '192.168.46.100';
+
const proxy = httpProxy.createProxyServer({
- target: 'http://192.168.46.100:9101'
+ target: `http://${target}:9101`
});
const extensionsProxy = httpProxy.createProxyServer({
- target: 'http://192.168.46.100/spa/'
+ target: `http://${target}/spa/`
});
proxy.on('error', function(error, req, res) {