1
Fork 0

Make NEXT_PUBLIC_SITE_NAME evaluate at runtime

This commit is contained in:
Steffo 2023-08-04 22:16:46 +02:00
parent bb54ebf9c9
commit 34b20c92ce
Signed by: steffo
GPG key ID: 2A24051445686895
5 changed files with 19 additions and 2 deletions

View file

@ -9,6 +9,7 @@
<node-interpreter value="project" /> <node-interpreter value="project" />
<envs> <envs>
<env name="NEXT_PUBLIC_API_BASE_URL" value="ws://192.168.1.135:8080" /> <env name="NEXT_PUBLIC_API_BASE_URL" value="ws://192.168.1.135:8080" />
<env name="NEXT_PUBLIC_SITE_NAME" value="Tododev" />
</envs> </envs>
<method v="2" /> <method v="2" />
</configuration> </configuration>

View file

@ -18,9 +18,11 @@
"@types/react": "18.2.17", "@types/react": "18.2.17",
"@types/react-dom": "18.2.7", "@types/react-dom": "18.2.7",
"classnames": "^2.3.2", "classnames": "^2.3.2",
"client-only": "^0.0.1",
"next": "13.4.12", "next": "13.4.12",
"react": "18.2.0", "react": "18.2.0",
"react-dom": "18.2.0", "react-dom": "18.2.0",
"server-only": "^0.0.1",
"typescript": "5.1.6" "typescript": "5.1.6"
} }
} }

View file

@ -0,0 +1,7 @@
import "server-only"
export function SiteName() {
return <>
{process.env["NEXT_PUBLIC_SITE_NAME"] ?? "Todoblue"}
</>
}

View file

@ -1,8 +1,10 @@
import {CreatePrivateBoardPanel} from "@/app/CreatePrivateBoardPanel" import {CreatePrivateBoardPanel} from "@/app/CreatePrivateBoardPanel"
import {CreatePublicBoardPanel} from "@/app/CreatePublicBoardPanel" import {CreatePublicBoardPanel} from "@/app/CreatePublicBoardPanel"
import {SiteName} from "@/app/SiteName"
import {default as React} from "react"; import {default as React} from "react";
import style from "./page.module.css" import style from "./page.module.css"
export default function Page() { export default function Page() {
return <div className={style.pageRoot}> return <div className={style.pageRoot}>
<PageHeader/> <PageHeader/>
@ -15,7 +17,7 @@ function PageHeader() {
return ( return (
<header className={style.pageHeader}> <header className={style.pageHeader}>
<h1> <h1>
{process.env.NEXT_PUBLIC_SITE_NAME ?? "Todoblue"} <SiteName/>
</h1> </h1>
</header> </header>
) )

View file

@ -154,7 +154,7 @@ classnames@^2.3.2:
resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.3.2.tgz#351d813bf0137fcc6a76a16b88208d2560a0d924" resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.3.2.tgz#351d813bf0137fcc6a76a16b88208d2560a0d924"
integrity sha512-CSbhY4cFEJRe6/GQzIk5qXZ4Jeg5pcsP7b5peFSDpffpe1cqjASH/n9UTjBwOp6XpMSTwQ8Za2K5V02ueA7Tmw== integrity sha512-CSbhY4cFEJRe6/GQzIk5qXZ4Jeg5pcsP7b5peFSDpffpe1cqjASH/n9UTjBwOp6XpMSTwQ8Za2K5V02ueA7Tmw==
client-only@0.0.1: client-only@0.0.1, client-only@^0.0.1:
version "0.0.1" version "0.0.1"
resolved "https://registry.yarnpkg.com/client-only/-/client-only-0.0.1.tgz#38bba5d403c41ab150bff64a95c85013cf73bca1" resolved "https://registry.yarnpkg.com/client-only/-/client-only-0.0.1.tgz#38bba5d403c41ab150bff64a95c85013cf73bca1"
integrity sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA== integrity sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==
@ -270,6 +270,11 @@ scheduler@^0.23.0:
dependencies: dependencies:
loose-envify "^1.1.0" loose-envify "^1.1.0"
server-only@^0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/server-only/-/server-only-0.0.1.tgz#0f366bb6afb618c37c9255a314535dc412cd1c9e"
integrity sha512-qepMx2JxAa5jjfzxG79yPPq+8BuFToHd1hm7kI+Z4zAq1ftQiP7HcxMhDDItrbtwVeLg/cY2JnKnrcFkmiswNA==
source-map-js@^1.0.2: source-map-js@^1.0.2:
version "1.0.2" version "1.0.2"
resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.0.2.tgz#adbc361d9c62df380125e7f161f71c826f1e490c" resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.0.2.tgz#adbc361d9c62df380125e7f161f71c826f1e490c"