1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-04-26 10:45:23 -04:00

move messy base URL definition to build time in next.config.js

This commit is contained in:
Jake Jarvis 2022-07-30 19:36:42 -04:00
parent 0a9391ed5f
commit 43d4b2ea46
Signed by: jake
GPG Key ID: 2B0C9CF251E69A39
2 changed files with 7 additions and 9 deletions

View File

@ -6,13 +6,7 @@ module.exports = {
siteDomain: "jarv.is",
siteLocale: "en-US",
timeZone: "America/New_York", // https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List
baseUrl:
// NOTE: no trailing slashes!
process.env.NEXT_PUBLIC_VERCEL_ENV !== "production" && process.env.NEXT_PUBLIC_VERCEL_URL !== undefined
? `https://${process.env.NEXT_PUBLIC_VERCEL_URL}`
: process.env.IS_DEV_SERVER === "true"
? `http://localhost:${process.env.NEXT_DEV_PORT}`
: "https://jarv.is", // fallback to production URL
baseUrl: process.env.BASE_URL || "", // see next.config.js
onionDomain: "http://jarvis2i2vp4j4tbxjogsnqdemnte5xhzyi7hziiyzxwge3hzmh57zad.onion",
shortDescription: "Front-End Web Developer in Boston, MA",
longDescription:

View File

@ -14,12 +14,16 @@ module.exports = (phase) => {
trailingSlash: true,
productionBrowserSourceMaps: true,
env: {
BASE_URL:
process.env.NEXT_PUBLIC_VERCEL_ENV !== "production" && process.env.NEXT_PUBLIC_VERCEL_URL !== undefined
? `https://${process.env.NEXT_PUBLIC_VERCEL_URL}` // https://vercel.com/docs/concepts/projects/environment-variables#system-environment-variables
: phase === PHASE_DEVELOPMENT_SERVER
? `http://localhost:${process.env.PORT || 3000}` // https://nextjs.org/docs/api-reference/cli#development
: `https://${config.siteDomain}`, // fallback to production url
// freeze build timestamp for when server-side pages need a "last updated" date:
RELEASE_DATE: new Date().toISOString(),
// check if we're running locally via `next dev`:
IS_DEV_SERVER: phase === PHASE_DEVELOPMENT_SERVER ? "true" : "",
// https://nextjs.org/docs/api-reference/cli#development
NEXT_DEV_PORT: process.env.PORT || "3000",
},
images: {
deviceSizes: [640, 750, 828, 1080, 1200, 1920],