From 0d477210f9fca7f4e969b9f16b08a9abbb431858 Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Fri, 11 Dec 2015 13:58:58 -0700 Subject: [PATCH] Add Config.general.menuFile: Specify name or path of menu HJSON file. Defaults to menu.hjson in mods --- core/config.js | 3 +++ core/menu_util.js | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/core/config.js b/core/config.js index 2fe4cc30..d3e02122 100644 --- a/core/config.js +++ b/core/config.js @@ -85,8 +85,11 @@ function getDefaultConfig() { closedSystem : false, // is the system closed to new users? loginAttempts : 3, + + menuFile : 'menu.hjson', // Override to use something else, e.g. demo.hjson. Can be a full path (defaults to ./mods) }, + // :TODO: see notes below about 'theme' section - move this! preLoginTheme : '*', users : { diff --git a/core/menu_util.js b/core/menu_util.js index 58bbb24f..abca4e94 100644 --- a/core/menu_util.js +++ b/core/menu_util.js @@ -31,7 +31,14 @@ function getMenuConfig(name, cb) { async.waterfall( [ function loadMenuJSON(callback) { - configCache.getModConfig('menu.hjson', function loaded(err, menuJson) { + var menuFilePath = Config.general.menuFile; + + // menuFile is assumed to be in 'mods' if a path is not supplied + if('.' === paths.dirname(menuFilePath)) { + menuFilePath = paths.join(__dirname, '../mods', menuFilePath); + } + + configCache.getConfig(menuFilePath, function loaded(err, menuJson) { callback(err, menuJson); }); },