获取cli安装目录
cml -v
[INFO] current running chameleon(安装目录)
修改安装目录/configs/config.js
增加一个获取局域网ip地址的函数
function getLocalAddress() {
let localWlanHost = 'localhost';
try {
const ifaces = require('os').networkInterfaces();
for (let dev in ifaces) {
ifaces[dev].forEach((details, alias) => {
if (details.family === 'IPv4' && !details.internal && details.address.startsWith('192')) {
localWlanHost = details.address;
}
});
}
} catch (e) { }
return localWlanHost;
}
ip获取方式修改为使用上面的函数
// ip: require('ip').address()
ip: getLocalAddress()
网友评论