mirror of
https://github.com/pockethost/pockethost.git
synced 2025-07-10 06:42:30 +00:00
refactor: env var on www
This commit is contained in:
parent
6d38fe9006
commit
c812cc247f
@ -7,29 +7,41 @@ const { boolean } = require('boolean')
|
||||
|
||||
const env = {
|
||||
// The domain name of the lander/marketing site
|
||||
PUBLIC_BLOG_DOMAIN: process.env.PUBLIC_BLOG_DOMAIN || 'pockethost.io',
|
||||
PUBLIC_BLOG_SUBDOMAIN: process.env.PUBLIC_BLOG_SUBDOMAIN || '',
|
||||
|
||||
// The domain name where this dashboard lives
|
||||
PUBLIC_APP_DOMAIN: process.env.PUBLIC_APP_DOMAIN || 'app.pockethost.io',
|
||||
PUBLIC_APP_SUBDOMAIN: process.env.PUBLIC_APP_SUBDOMAIN || 'app',
|
||||
|
||||
// The domain name apex where all instances live (eg, <subdomain>.pockethost.io)
|
||||
PUBLIC_EDGE_APEX_DOMAIN:
|
||||
process.env.PUBLIC_EDGE_APEX_DOMAIN || 'pockethost.io',
|
||||
PUBLIC_APEX_DOMAIN: process.env.PUBLIC_APEX_DOMAIN || 'pockethost.io',
|
||||
|
||||
// The domain name apex where all instances live (eg, <subdomain>.pockethost.io)
|
||||
PUBLIC_EDGE_SUBDOMAIN: process.env.PUBLIC_EDGE_SUBDOMAIN || 'edge',
|
||||
|
||||
// The protocol to use, almost always will be https
|
||||
PUBLIC_HTTP_PROTOCOL: process.env.PUBLIC_HTTP_PROTOCOL || 'https',
|
||||
|
||||
// The complete URL to the mothership
|
||||
PUBLIC_MOTHERSHIP_NAME:
|
||||
process.env.PUBLIC_MOTHERSHIP_NAME || `pockethost-central`,
|
||||
PUBLIC_MOTHERSHIP_SUBDOMAIN:
|
||||
process.env.PUBLIC_MOTHERSHIP_SUBDOMAIN || `pockethost-central`,
|
||||
|
||||
// Whether or not we are in debugging mode - default TRUE
|
||||
PUBLIC_DEBUG: boolean(process.env.PUBLIC_DEBUG || 'true'),
|
||||
}
|
||||
|
||||
const mkFqDomain = (subdomain) =>
|
||||
`${subdomain ? `${subdomain}.` : ''}${env.PUBLIC_APEX_DOMAIN}`
|
||||
const mkUrl = (subdomain, path = '') =>
|
||||
`${env.PUBLIC_HTTP_PROTOCOL}://${mkFqDomain(subdomain)}${path}`
|
||||
const mkAppUrl = (path = '') => mkUrl(env.PUBLIC_APP_SUBDOMAIN, path)
|
||||
const mkBlogUrl = (path = '') => mkUrl(env.PUBLIC_BLOG_SUBDOMAIN, path)
|
||||
const mkEdgeSubdomain = (subdomain) =>
|
||||
mkFqDomain(`${subdomain}.${env.PUBLIC_EDGE_SUBDOMAIN}`)
|
||||
const mkEdgeUrl = (subdomain, path = '') =>
|
||||
mkUrl(mkEdgeSubdomain(subdomain), path)
|
||||
|
||||
// Derived values
|
||||
env.APP_URL = `${env.PUBLIC_HTTP_PROTOCOL}://${env.PUBLIC_APP_DOMAIN}`
|
||||
env.BLOG_URL = `${env.PUBLIC_HTTP_PROTOCOL}://${env.PUBLIC_BLOG_DOMAIN}`
|
||||
env.MOTHERSHIP_URL = `${env.PUBLIC_HTTP_PROTOCOL}://${env.PUBLIC_MOTHERSHIP_NAME}.${this.PUBLIC_EDGE_APEX_DOMAIN}`
|
||||
env.APP_URL = mkAppUrl()
|
||||
env.BLOG_URL = mkBlogUrl()
|
||||
|
||||
module.exports = env
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
<!-- Twitter Meta Tags -->
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
<meta property="twitter:domain" content="{{ env.BLOG_DOMAIN }}">
|
||||
<meta property="twitter:domain" content="{{ env.PUBLIC_APEX_DOMAIN }}">
|
||||
<meta property="twitter:url" content="{{ metadata.url + page.url }}">
|
||||
<meta name="twitter:title" content="{{ title }} - PocketHost">
|
||||
<meta name="twitter:description" content="{{ description or metadata.description }}">
|
||||
|
Loading…
x
Reference in New Issue
Block a user