Spaces:
Running
Running
File size: 628 Bytes
f120063 4289eb1 f120063 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | const path = require('path')
const resolvePath = (targetPath, fallbackPath) => {
if (targetPath && targetPath.trim()) {
return path.resolve(targetPath)
}
return path.resolve(fallbackPath)
}
const dataDir = resolvePath(process.env.DATA_DIR, path.join(__dirname, '../../data'))
const cacheDir = resolvePath(process.env.CACHE_DIR, path.join(__dirname, '../../caches'))
const logDir = resolvePath(process.env.LOG_DIR, path.join(__dirname, '../../logs'))
module.exports = {
dataDir,
cacheDir,
logDir,
dataFilePath: path.join(dataDir, 'data.json'),
usageStatsFilePath: path.join(dataDir, 'usage-stats.json')
}
|