mirror of
https://github.com/Lissy93/dashy.git
synced 2025-07-23 21:55:30 +02:00
✨ Makes config location user-configurable
This commit is contained in:
parent
6fa782d6a8
commit
49eb262465
11
src/store.js
11
src/store.js
@ -293,15 +293,11 @@ const store = new Vuex.Store({
|
|||||||
InfoHandler('Color palette updated', InfoKeys.VISUAL);
|
InfoHandler('Color palette updated', InfoKeys.VISUAL);
|
||||||
},
|
},
|
||||||
[SET_ITEM_LAYOUT](state, layout) {
|
[SET_ITEM_LAYOUT](state, layout) {
|
||||||
const newConfig = { ...state.config };
|
state.config.appConfig.layout = layout;
|
||||||
newConfig.appConfig.layout = layout;
|
|
||||||
state.config = newConfig;
|
|
||||||
InfoHandler('Layout updated', InfoKeys.VISUAL);
|
InfoHandler('Layout updated', InfoKeys.VISUAL);
|
||||||
},
|
},
|
||||||
[SET_ITEM_SIZE](state, iconSize) {
|
[SET_ITEM_SIZE](state, iconSize) {
|
||||||
const newConfig = { ...state.config };
|
state.config.appConfig.iconSize = iconSize;
|
||||||
newConfig.appConfig.iconSize = iconSize;
|
|
||||||
state.config = newConfig;
|
|
||||||
InfoHandler('Item size updated', InfoKeys.VISUAL);
|
InfoHandler('Item size updated', InfoKeys.VISUAL);
|
||||||
},
|
},
|
||||||
[UPDATE_CUSTOM_CSS](state, customCss) {
|
[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 */
|
/* Fetches the root config file, only ever called by INITIALIZE_CONFIG */
|
||||||
async [INITIALIZE_ROOT_CONFIG]({ commit }) {
|
async [INITIALIZE_ROOT_CONFIG]({ commit }) {
|
||||||
// Load and parse config from root config file
|
// 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
|
// Replace missing root properties with empty objects
|
||||||
if (!data.appConfig) data.appConfig = {};
|
if (!data.appConfig) data.appConfig = {};
|
||||||
if (!data.pageInfo) data.pageInfo = {};
|
if (!data.pageInfo) data.pageInfo = {};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user