diff --git a/cli/devicecontroller.js b/cli/devicecontroller.js index f8f8b79..ec3cd04 100644 --- a/cli/devicecontroller.js +++ b/cli/devicecontroller.js @@ -50,8 +50,10 @@ function storeSdkServerConfiguration(brain, sdkOptions, devices) { const { serverPort, serverName } = sdkOptions; serverConfiguration = { brain, - port: serverPort || 6336, + port: serverPort || process.env.NEEO_SERVER_PORT || 6336, name: serverName || 'default', + adapterIpAddress: process.env.NEEO_SERVER_IP, + baseurl: process.env.NEEO_SERVER_BASEURL, devices, }; } diff --git a/lib/device/index.js b/lib/device/index.js index 30d35b4..87bc7da 100644 --- a/lib/device/index.js +++ b/lib/device/index.js @@ -85,7 +85,7 @@ function generateAdapterName(conf) { } function generateBaseUrl(conf) { - const ipaddress = validation.getAnyIpAddress(); + const ipaddress = conf.adapterIpAddress || validation.getAnyIpAddress(); const baseUrl = 'http://' + ipaddress + ':' + conf.port; debug('Adapter baseUrl %s', baseUrl); return baseUrl; diff --git a/test/unit/cli/devicecontroller_test.js b/test/unit/cli/devicecontroller_test.js index fe39c4c..778a0f6 100644 --- a/test/unit/cli/devicecontroller_test.js +++ b/test/unit/cli/devicecontroller_test.js @@ -76,6 +76,8 @@ describe('./cli/devicecontroller.js', function() { }, port: 6336, name: 'default', + adapterIpAddress: undefined, + baseurl: undefined, devices: [device], }); }); @@ -95,6 +97,8 @@ describe('./cli/devicecontroller.js', function() { }, port: 6336, name: 'default', + adapterIpAddress: undefined, + baseurl: undefined, devices: [device], }); });