From 49eb262465737c61aec28e159ceaa10a0486e8f6 Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Tue, 9 Apr 2024 20:35:25 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Makes=20config=20location=20user-co?= =?UTF-8?q?nfigurable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/store.js b/src/store.js index 5bbde59a..5a0d3b80 100644 --- a/src/store.js +++ b/src/store.js @@ -293,15 +293,11 @@ const store = new Vuex.Store({ InfoHandler('Color palette updated', InfoKeys.VISUAL); }, [SET_ITEM_LAYOUT](state, layout) { - const newConfig = { ...state.config }; - newConfig.appConfig.layout = layout; - state.config = newConfig; + state.config.appConfig.layout = layout; InfoHandler('Layout updated', InfoKeys.VISUAL); }, [SET_ITEM_SIZE](state, iconSize) { - const newConfig = { ...state.config }; - newConfig.appConfig.iconSize = iconSize; - state.config = newConfig; + state.config.appConfig.iconSize = iconSize; InfoHandler('Item size updated', InfoKeys.VISUAL); }, [UPDATE_CUSTOM_CSS](state, customCss) { @@ -320,7 +316,8 @@ const store = new Vuex.Store({ /* Fetches the root config file, only ever called by INITIALIZE_CONFIG */ async [INITIALIZE_ROOT_CONFIG]({ commit }) { // Load and parse config from root config file - const data = await yaml.load((await axios.get('/conf.yml')).data); + const configFilePath = process.env.VUE_APP_CONFIG_PATH || '/conf.yml'; + const data = await yaml.load((await axios.get(configFilePath)).data); // Replace missing root properties with empty objects if (!data.appConfig) data.appConfig = {}; if (!data.pageInfo) data.pageInfo = {};