zigbee2mqtt/lib/util/data.js

16 lines
346 B
JavaScript
Raw Normal View History

2018-05-11 20:04:15 -07:00
const path = require('path');
2018-05-12 01:58:06 -07:00
let dataPath = null;
if (process.env.ZIGBEE2MQTT_DATA) {
dataPath = process.env.ZIGBEE2MQTT_DATA;
2018-05-17 08:20:46 -07:00
} else {
2018-05-12 01:58:06 -07:00
dataPath = path.join(__dirname, '..', '..', 'data');
dataPath = path.normalize(dataPath);
2018-05-11 20:04:15 -07:00
}
module.exports = {
2018-05-17 08:20:46 -07:00
joinPath: (file) => path.join(dataPath, file),
getPath: () => dataPath,
2018-05-17 08:20:46 -07:00
};