mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-08-21 16:50:54 +02:00
noWatch -> hotReload
This commit is contained in:
parent
cfaff61abf
commit
e674079f53
3 changed files with 13 additions and 11 deletions
|
@ -2,10 +2,11 @@
|
|||
'use strict';
|
||||
|
||||
// deps
|
||||
const paths = require('path');
|
||||
const fs = require('graceful-fs');
|
||||
const hjson = require('hjson');
|
||||
const sane = require('sane');
|
||||
const paths = require('path');
|
||||
const fs = require('graceful-fs');
|
||||
const hjson = require('hjson');
|
||||
const sane = require('sane');
|
||||
const _ = require('lodash');
|
||||
|
||||
module.exports = new class ConfigCache
|
||||
{
|
||||
|
@ -14,12 +15,13 @@ module.exports = new class ConfigCache
|
|||
}
|
||||
|
||||
getConfigWithOptions(options, cb) {
|
||||
options.hotReload = _.get(options, 'hotReload', true);
|
||||
const cached = this.cache.has(options.filePath);
|
||||
|
||||
if(options.forceReCache || !cached) {
|
||||
this.recacheConfigFromFile(options.filePath, (err, config) => {
|
||||
if(!err && !cached) {
|
||||
if(!options.noWatch) {
|
||||
if(options.hotReload) {
|
||||
const watcher = sane(
|
||||
paths.dirname(options.filePath),
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue