diff --git a/src/components/Layout/LayoutHeader.vue b/src/components/Layout/LayoutHeader.vue index 9167257..5487eca 100644 --- a/src/components/Layout/LayoutHeader.vue +++ b/src/components/Layout/LayoutHeader.vue @@ -12,7 +12,7 @@ @@ -52,6 +52,12 @@ diff --git a/src/constants/defaultConfig.js b/src/constants/defaultConfig.js new file mode 100644 index 0000000..e9df82e --- /dev/null +++ b/src/constants/defaultConfig.js @@ -0,0 +1,7 @@ +export default { + base_url: '/', + hash_mode: false, + map_tile_server: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', + map_tile_attribution: + '© OpenStreetMap contributors' +} diff --git a/src/utils/loadConfiguration.js b/src/utils/loadConfiguration.js index 97d76a5..8fd93b6 100644 --- a/src/utils/loadConfiguration.js +++ b/src/utils/loadConfiguration.js @@ -1,10 +1,13 @@ import fs from 'fs' import yaml from 'js-yaml' import glob from 'glob' +import defaultConfig from '../constants/defaultConfig' -export const loadConfiguration = appPath => { +export const loadConfiguration = (appPath) => { const filePaths = glob.sync(appPath + '/config/*.yml', {}) - const jsonConfig = filePaths.map(filepath => yaml.load(fs.readFileSync(filepath, 'utf8'))) + const jsonConfig = filePaths.map((filepath) => + yaml.load(fs.readFileSync(filepath, 'utf8')) + ) - return Object.assign({}, ...jsonConfig) + return Object.assign({}, defaultConfig, ...jsonConfig) } diff --git a/src/utils/url.js b/src/utils/url.js new file mode 100644 index 0000000..ce665d3 --- /dev/null +++ b/src/utils/url.js @@ -0,0 +1,8 @@ +export function isValidUrl(string) { + try { + new URL(string) + return true + } catch (err) { + return false + } +}