enigma-bbs/core/config_util.js

18 lines
522 B
JavaScript
Raw Normal View History

2016-01-15 05:56:21 +00:00
/* jslint node: true */
'use strict';
2017-11-22 23:27:33 +00:00
const Config = require('./config.js').config;
const configCache = require('./config_cache.js');
const paths = require('path');
2016-01-15 05:56:21 +00:00
exports.getFullConfig = getFullConfig;
function getFullConfig(filePath, cb) {
// |filePath| is assumed to be in the config path if it's only a file name
2016-01-15 05:56:21 +00:00
if('.' === paths.dirname(filePath)) {
2017-11-22 23:27:33 +00:00
filePath = paths.join(Config.paths.config, filePath);
2016-01-15 05:56:21 +00:00
}
configCache.getConfig(filePath, function loaded(err, configJson) {
cb(err, configJson);
});
}