diff --git a/.gitignore b/.gitignore index fd3dbb5..5ff9804 100644 --- a/.gitignore +++ b/.gitignore @@ -25,8 +25,9 @@ npm-debug.log* yarn-debug.log* yarn-error.log* -# local env files +# local conig files .env*.local +config.toml # vercel .vercel diff --git a/package.json b/package.json index dbb3438..32e40f0 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,8 @@ "prism-react-renderer": "^2.4.0", "react": "^18", "react-dom": "^18", - "react-markdown": "^9.0.1" + "react-markdown": "^9.0.1", + "toml": "^3.0.0" }, "devDependencies": { "@types/node": "^20", diff --git a/src/app/[...file]/page.tsx b/src/app/[...file]/page.tsx index cde757a..d1489bd 100644 --- a/src/app/[...file]/page.tsx +++ b/src/app/[...file]/page.tsx @@ -2,6 +2,7 @@ import type { Metadata } from 'next'; import Image from 'next/image'; import * as style from './page.css'; +import config from '../config.ts'; import Content from './components/content'; import Copy from './components/copy'; import download_image_dark from './download_dark.svg'; @@ -33,9 +34,8 @@ export async function generateMetadata( export default async function Page({ params, searchParams }: Props) { - const enable_repointing = process.env.ENABLE_REPOINTING == 'true'; const path = get_path(params.file); - const root = get_root(enable_repointing, searchParams); + const root = get_root(config.enable_repointing, searchParams); const full = `${root}${path}`; const download_ttys = [ @@ -69,7 +69,7 @@ export default async function Page({
Error: this instance of Motto does not have repointing enabled
:This instance is currently pointed to {process.env.ROOT_URL} { - supports_repointing ? + config.enable_repointing ? <>but supports repointing.> : <>and does not support repointing.> }
diff --git a/yarn.lock b/yarn.lock index 97da2a9..ccc6fee 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3802,6 +3802,11 @@ to-regex-range@^5.0.1: dependencies: is-number "^7.0.0" +toml@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/toml/-/toml-3.0.0.tgz#342160f1af1904ec9d204d03a5d61222d762c5ee" + integrity sha512-y/mWCZinnvxjTKYhJ+pYxwD0mRLVvOtdS2Awbgxln6iEnt4rk0yBxeSBHkGJcPucRiG0e55mwWp+g/05rsrd6w== + trim-lines@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/trim-lines/-/trim-lines-3.0.1.tgz#d802e332a07df861c48802c04321017b1bd87338"