move typekit id to env var

This commit is contained in:
Matthias Kretschmann 2021-09-12 23:28:40 +02:00
parent 084e7a4572
commit 40d6560450
Signed by: m
GPG Key ID: 606EEEF3C479A91F
6 changed files with 9 additions and 6 deletions

1
.env Normal file
View File

@ -0,0 +1 @@
NEXT_PUBLIC_TYPEKIT_ID=msu4qap

1
.env.sample Normal file
View File

@ -0,0 +1 @@
NEXT_PUBLIC_TYPEKIT_ID=xxx

View File

@ -27,3 +27,5 @@ jobs:
- run: npm ci - run: npm ci
- run: npm test - run: npm test
- run: npm run build - run: npm run build
env:
NEXT_PUBLIC_TYPEKIT_ID: ${{ secrets.NEXT_PUBLIC_TYPEKIT_ID }}

View File

@ -19,6 +19,7 @@ This repo holds a React app built with [Next.js](https://nextjs.org) serving as
```bash ```bash
npm i npm i
cp .env.sample .env
npm start npm start
``` ```

View File

@ -3,6 +3,5 @@ module.exports = {
description: 'A public IPFS Gateway', description: 'A public IPFS Gateway',
url: 'https://ipfs.kretschmann.io', url: 'https://ipfs.kretschmann.io',
ipfsGateway: 'https://ipfs.kretschmann.io', ipfsGateway: 'https://ipfs.kretschmann.io',
ipfsNodeUri: 'https://ipfs.kretschmann.io:443', ipfsNodeUri: 'https://ipfs.kretschmann.io:443'
typekitId: 'msu4qap'
} }

View File

@ -1,11 +1,10 @@
import React, { ReactElement } from 'react' import React, { ReactElement } from 'react'
import Head from 'next/head' import Head from 'next/head'
import { typekitId } from '../../site.config'
const typekitScript = ` const typekitScript = `
(function(d) { (function(d) {
var config = { var config = {
kitId: '${typekitId}', kitId: '${process.env.NEXT_PUBLIC_TYPEKIT_ID}',
scriptTimeout: 3000, scriptTimeout: 3000,
async: true async: true
}, },
@ -14,11 +13,11 @@ const typekitScript = `
` `
export default function Typekit(): ReactElement | null { export default function Typekit(): ReactElement | null {
return typekitId ? ( return (
<Head key="typekit"> <Head key="typekit">
<link rel="dns-prefetch" href="https://use.typekit.net/" /> <link rel="dns-prefetch" href="https://use.typekit.net/" />
<link rel="dns-prefetch" href="https://p.typekit.net/" /> <link rel="dns-prefetch" href="https://p.typekit.net/" />
<script dangerouslySetInnerHTML={{ __html: typekitScript }} /> <script dangerouslySetInnerHTML={{ __html: typekitScript }} />
</Head> </Head>
) : null )
} }