18 lines
591 B
JavaScript
18 lines
591 B
JavaScript
export default {
|
|
install(Vue) {
|
|
var config = Vue.observable(require('@/assets/config.json'));
|
|
const getRuntimeConfig = async () => {
|
|
const runtimeConfig = await fetch('./config.json');
|
|
return await runtimeConfig.json()
|
|
}
|
|
|
|
config.promise = getRuntimeConfig();
|
|
config.promise.then(function (json) {
|
|
// Reactively use all the config values
|
|
for (const key of Object.keys(json)) {
|
|
Vue.set(config, key, json[key]);
|
|
}
|
|
});
|
|
Vue.prototype.$config = config;
|
|
}
|
|
}
|