Skip to content

Commit 24d281e

Browse files
committed
refactor(env): prefix SITE_ROOT w/ NEXT_PUBLIC_
Prefix `SITE_ROOT` with `NEXT_PUBLIC_` to streamline environment variable config, per Next.js latest feature. Ref: https://nextjs.org/docs/app/building-your-application/configuring/environment-variables#bundling-environment-variables-for-the-browser
1 parent 4e94c87 commit 24d281e

File tree

5 files changed

+4
-8
lines changed

5 files changed

+4
-8
lines changed

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
SITE_ROOT=https://docs.dorafactory.org
1+
NEXT_PUBLIC_SITE_ROOT=https://docs.dorafactory.org

.env.development

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
SITE_ROOT=http://localhost:3000
1+
NEXT_PUBLIC_SITE_ROOT=http://localhost:3000

next.config.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ module.exports = withNextra({
1212
reactStrictMode: true, // Recommended for the `pages` directory, default in `app`.
1313
output: 'standalone',
1414

15-
env: {
16-
SITE_ROOT: process.env.SITE_ROOT
17-
},
18-
1915
webpack(config) {
2016
// Config for SVGR
2117
// const allowedSvgRegex = /\.svg$/i

pages/docs/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export const CARD_COPY = [
4242
<>
4343
<img
4444
alt={card.title}
45-
src={`${process.env.SITE_ROOT}/api/og?title=${card.title}&desc=${card.desc}`}
45+
src={`${process.env.NEXT_PUBLIC_SITE_ROOT}/api/og?title=${card.title}&desc=${card.desc}`}
4646
/>
4747
</>
4848
</Cards.Card>

theme.config.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default {
1313
title: 'The Digital Infrastructure of Global Hacker Movement',
1414
desc: 'Dora Factory creates protocols, toolings, and public good infrastructures that help open source communities and frontier tech builders to thrive.'
1515
}
16-
const SITE_ROOT = process.env.SITE_ROOT
16+
const SITE_ROOT = process.env.NEXT_PUBLIC_SITE_ROOT
1717
const asPath = router.asPath
1818

1919
// Open Graph

0 commit comments

Comments
 (0)