mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig.space.git
synced 2025-12-18 18:54:24 +00:00
Update base URL handling
This commit is contained in:
@@ -2,9 +2,7 @@
|
|||||||
const helpers = require('./helpers')
|
const helpers = require('./helpers')
|
||||||
|
|
||||||
const IS_DEV = process.env.NODE_ENV === 'development'
|
const IS_DEV = process.env.NODE_ENV === 'development'
|
||||||
const { DEPLOY_PRIME_URL, URL } = process.env
|
const HOST = IS_DEV ? 'http://localhost:3000' : getBaseUrl()
|
||||||
const BASE = DEPLOY_PRIME_URL || URL || 'https://einundzwanzig.space'
|
|
||||||
const HOST = IS_DEV ? 'http://localhost:3000' : BASE
|
|
||||||
const random = max => Math.floor(Math.random() * Math.floor(max))
|
const random = max => Math.floor(Math.random() * Math.floor(max))
|
||||||
const shuffle = arr => { for (let i = arr.length - 1; i > 0; i--) { const j = Math.floor(Math.random() * i); const temp = arr[i]; arr[i] = arr[j]; arr[j] = temp; }; return arr }
|
const shuffle = arr => { for (let i = arr.length - 1; i > 0; i--) { const j = Math.floor(Math.random() * i); const temp = arr[i]; arr[i] = arr[j]; arr[j] = temp; }; return arr }
|
||||||
const formatDate = date => (new Date(date)).toISOString().replace(/T.*/, '').split('-').reverse().join('.')
|
const formatDate = date => (new Date(date)).toISOString().replace(/T.*/, '').split('-').reverse().join('.')
|
||||||
@@ -22,6 +20,11 @@ const assetUrl = (path, protocol = 'https') => {
|
|||||||
if (!url.startsWith(`${protocol}:`)) url = url.replace(/^.*:/, `${protocol}:`)
|
if (!url.startsWith(`${protocol}:`)) url = url.replace(/^.*:/, `${protocol}:`)
|
||||||
return url
|
return url
|
||||||
}
|
}
|
||||||
|
function getBaseUrl () {
|
||||||
|
const { DEPLOY_PRIME_URL, URL } = process.env
|
||||||
|
const branchUrl = DEPLOY_PRIME_URL || URL || ''
|
||||||
|
return !branchUrl.match('master--einundzwanzig') ? branchUrl : 'https://einundzwanzig.space'
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
basedir: './src/includes',
|
basedir: './src/includes',
|
||||||
|
|||||||
Reference in New Issue
Block a user