azure-iot-gateway
Version:
Azure IoT Edge Core Runtime.
36 lines (30 loc) • 941 B
JavaScript
module.exports = class Gateway {
constructor(configPath) {
this.configPath = configPath;
}
run() {
var gw = null;
var osId = null;
var output = null;
if (process.platform === 'win32') {
gw = require('azure-iot-gateway-windows');
} else if (process.platform === 'linux') {
var childProcess = require('child_process');
output = childProcess.execSync('. /etc/os-release && echo $ID');
osId = output.toString().trim();
if(osId === 'ubuntu') {
gw = require('azure-iot-gateway-ubuntu');
} else if (osId === 'raspbian') {
gw = require('azure-iot-gateway-raspbian');
} else if (osId === 'debian') {
gw = require('azure-iot-gateway-debian');
} else {
console.error(osId + ' is not currently supported by Azure IoT Edge.');
process.exit(2989);
}
}
gw.run(this.configPath);
}
}