From 97d5b294ef9c7fd39826e244fc97c919e4afe2fd Mon Sep 17 00:00:00 2001 From: Jeff Parsons Date: Mon, 25 Sep 2017 15:35:25 -0700 Subject: [PATCH] The Node server will now honor an explicit "--cache" regardless whether "--debug" has been set --- modules/htmlout/lib/htmlout.js | 8 ++++++-- server.js | 14 +++++++------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/modules/htmlout/lib/htmlout.js b/modules/htmlout/lib/htmlout.js index e6b916bbd..a920dcbc8 100644 --- a/modules/htmlout/lib/htmlout.js +++ b/modules/htmlout/lib/htmlout.js @@ -62,8 +62,12 @@ var pkg = require("../../../package.json"); /* * fCache controls "index.html" caching; it is true by default and can be overridden using the setOptions() * 'cache' property. + * + * NOTE: Even though we don't explicitly set fCache to true, that's the default, because we disable caching + * only when fCache is explicitly false; this is so we can detect when it has been explicitly set to true, + * ensuring that we cache files even when other settings (like fServerDebug) might suggest we shouldn't cache. */ -var fCache = true; +var fCache; /* * fConsole controls console messages; it is false by default and can be overridden using the setOptions() @@ -326,7 +330,7 @@ function HTMLOut(sPath, sFile, fRebuild, req, done) * Check the global cache setting, as well as the presence of ANY special commands * that we would never want to cache. */ - if (!fCache || fServerDebug || net.hasParm(net.GORT_COMMAND, null, req) || net.hasParm(net.REVEAL_COMMAND, null, req)) { + if (fCache === false || fServerDebug && !fCache || net.hasParm(net.GORT_COMMAND, null, req) || net.hasParm(net.REVEAL_COMMAND, null, req)) { this.loadFile(this.sTemplateFile, true); return; } diff --git a/server.js b/server.js index fa80612f7..85d17b819 100644 --- a/server.js +++ b/server.js @@ -51,13 +51,13 @@ var defines = require("./modules/shared/lib/defines"); var proclib = require("./modules/shared/lib/proclib"); var args = proclib.getArgs(); -var fCache = (args.argv['cache'] === undefined? true : args.argv['cache']); -var fConsole = (args.argv['console'] === undefined? false : args.argv['console']); -var fDebug = (args.argv['debug'] === undefined? false : args.argv['debug']); -var fLogging = (args.argv['logging'] === undefined? false : args.argv['logging']); -var fPrivate = (args.argv['private'] === undefined? false : args.argv['private']); -var fRebuild = (args.argv['rebuild'] === undefined? false : args.argv['rebuild']); -var fSockets = (args.argv['sockets'] === undefined? false : args.argv['sockets']); +var fCache = args.argv['cache']; +var fConsole = args.argv['console']; +var fDebug = args.argv['debug']; +var fLogging = args.argv['logging']; +var fPrivate = args.argv['private']; +var fRebuild = args.argv['rebuild']; +var fSockets = args.argv['sockets']; var HTMLOut = require("./modules/htmlout");