From 8aa18454a51477abb2752867e1233e5eb702f901 Mon Sep 17 00:00:00 2001 From: jlpereira Date: Wed, 24 May 2023 12:57:04 -0300 Subject: [PATCH] Use base_url for logo --- src/components/Layout/LayoutHeader.vue | 10 ++++++++-- src/constants/defaultConfig.js | 7 +++++++ src/utils/loadConfiguration.js | 9 ++++++--- src/utils/url.js | 8 ++++++++ 4 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 src/constants/defaultConfig.js create mode 100644 src/utils/url.js 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 + } +}