make fresh mode the default behaviour

pull/1/head
ansuz 5 years ago
parent fcab0d4b6e
commit 1ec1d8b0e0

@ -32,6 +32,7 @@
"start": "node server.js", "start": "node server.js",
"dev": "DEV=1 node server.js", "dev": "DEV=1 node server.js",
"fresh": "FRESH=1 node server.js", "fresh": "FRESH=1 node server.js",
"package": "PACKAGE=1 node server.js",
"lint": "jshint --config .jshintrc --exclude-path .jshintignore . && ./node_modules/lesshint/bin/lesshint -c ./.lesshintrc ./customize.dist/src/less2/", "lint": "jshint --config .jshintrc --exclude-path .jshintignore . && ./node_modules/lesshint/bin/lesshint -c ./.lesshintrc ./customize.dist/src/less2/",
"lint:js": "jshint --config .jshintrc --exclude-path .jshintignore .", "lint:js": "jshint --config .jshintrc --exclude-path .jshintignore .",
"lint:less": "./node_modules/lesshint/bin/lesshint -c ./.lesshintrc ./customize.dist/src/less2/", "lint:less": "./node_modules/lesshint/bin/lesshint -c ./.lesshintrc ./customize.dist/src/less2/",

@ -38,22 +38,34 @@ var app = debuggable('app', Express());
var httpsOpts; var httpsOpts;
var DEV_MODE = !!process.env.DEV // mode can be FRESH (default), DEV, or PACKAGE
if (DEV_MODE) {
console.log("DEV MODE ENABLED");
}
var FRESH_MODE = !!process.env.FRESH;
var FRESH_KEY = ''; var FRESH_KEY = '';
if (FRESH_MODE) { var FRESH_MODE = true;
var DEV_MODE = false;
if (process.env.PACKAGE) {
// `PACKAGE=1 node server` uses the version string from package.json as the cache string
console.log("PACKAGE MODE ENABLED");
FRESH_MODE = false;
DEV_MODE = false;
} else if (process.env.DEV) {
// `DEV=1 node server` will use a random cache string on every page reload
console.log("DEV MODE ENABLED");
FRESH_MODE = false;
DEV_MODE = true;
} else {
// `FRESH=1 node server` will set a random cache string when the server is launched
// and use it for the process lifetime or until it is reset from the admin panel
console.log("FRESH MODE ENABLED"); console.log("FRESH MODE ENABLED");
FRESH_KEY = +new Date(); FRESH_KEY = +new Date();
} }
config.flushCache = function () { config.flushCache = function () {
FRESH_KEY = +new Date(); FRESH_KEY = +new Date();
if (!config.log) { return; }
config.log.info("UPDATING_FRESH_KEY", FRESH_KEY);
}; };
const clone = (x) => (JSON.parse(JSON.stringify(x))); const clone = (x) => (JSON.parse(JSON.stringify(x)));
var setHeaders = (function () { var setHeaders = (function () {

Loading…
Cancel
Save