From 40d6560450ca47e38504101ad7055d8563afdd33 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Sun, 12 Sep 2021 23:28:40 +0200 Subject: [PATCH] move typekit id to env var --- .env | 1 + .env.sample | 1 + .github/workflows/ci.yml | 2 ++ README.md | 1 + site.config.js | 3 +-- src/components/Typekit.tsx | 7 +++---- 6 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 .env create mode 100644 .env.sample diff --git a/.env b/.env new file mode 100644 index 0000000..87d44f7 --- /dev/null +++ b/.env @@ -0,0 +1 @@ +NEXT_PUBLIC_TYPEKIT_ID=msu4qap \ No newline at end of file diff --git a/.env.sample b/.env.sample new file mode 100644 index 0000000..f279456 --- /dev/null +++ b/.env.sample @@ -0,0 +1 @@ +NEXT_PUBLIC_TYPEKIT_ID=xxx \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ea03ad0..48d800e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,3 +27,5 @@ jobs: - run: npm ci - run: npm test - run: npm run build + env: + NEXT_PUBLIC_TYPEKIT_ID: ${{ secrets.NEXT_PUBLIC_TYPEKIT_ID }} diff --git a/README.md b/README.md index bfe986f..fc203ee 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ This repo holds a React app built with [Next.js](https://nextjs.org) serving as ```bash npm i +cp .env.sample .env npm start ``` diff --git a/site.config.js b/site.config.js index dff4f38..24b8121 100644 --- a/site.config.js +++ b/site.config.js @@ -3,6 +3,5 @@ module.exports = { description: 'A public IPFS Gateway', url: 'https://ipfs.kretschmann.io', ipfsGateway: 'https://ipfs.kretschmann.io', - ipfsNodeUri: 'https://ipfs.kretschmann.io:443', - typekitId: 'msu4qap' + ipfsNodeUri: 'https://ipfs.kretschmann.io:443' } diff --git a/src/components/Typekit.tsx b/src/components/Typekit.tsx index cd1bf8d..fb8cd41 100644 --- a/src/components/Typekit.tsx +++ b/src/components/Typekit.tsx @@ -1,11 +1,10 @@ import React, { ReactElement } from 'react' import Head from 'next/head' -import { typekitId } from '../../site.config' const typekitScript = ` (function(d) { var config = { - kitId: '${typekitId}', + kitId: '${process.env.NEXT_PUBLIC_TYPEKIT_ID}', scriptTimeout: 3000, async: true }, @@ -14,11 +13,11 @@ const typekitScript = ` ` export default function Typekit(): ReactElement | null { - return typekitId ? ( + return (