From 6097b1f960b349cae7e57e06aa96260a05531f7d Mon Sep 17 00:00:00 2001 From: George B <705427+georgeblahblah@users.noreply.github.com> Date: Wed, 6 Jul 2022 10:25:04 +0100 Subject: [PATCH 1/2] Load env vars from import.meta.env Now that https://github.com/withastro/astro/issues/2903 has been fixed, we can remove the workaround of loading from process.env --- src/components/BlogFeed.astro | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/BlogFeed.astro b/src/components/BlogFeed.astro index 53ef4063..08d5a915 100644 --- a/src/components/BlogFeed.astro +++ b/src/components/BlogFeed.astro @@ -1,7 +1,7 @@ --- import { timeAgo } from "@guardian/libs"; // workaround for buggy import.meta in SSR build (https://github.com/withastro/astro/issues/2903) -const CAPI_KEY = import.meta.env.CAPI_KEY ?? process.env.CAPI_KEY; +const CAPI_KEY = import.meta.env.CAPI_KEY ?? "test"; type SeriesResult = { id: string; @@ -23,7 +23,7 @@ type SeriesResult = { const queryParams = new URLSearchParams({ tag: "info/series/engineering-blog", "show-fields": "byline", - "api-key": CAPI_KEY ?? "test", + "api-key": CAPI_KEY, }); const posts: SeriesResult[] = await fetch( From f3c3f87ebe9acbeb8e65a58ab671422a6c06bb5c Mon Sep 17 00:00:00 2001 From: George B <705427+georgeblahblah@users.noreply.github.com> Date: Mon, 1 Aug 2022 10:00:24 +0100 Subject: [PATCH 2/2] Remove stale comment --- src/components/BlogFeed.astro | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/BlogFeed.astro b/src/components/BlogFeed.astro index 08d5a915..71b09633 100644 --- a/src/components/BlogFeed.astro +++ b/src/components/BlogFeed.astro @@ -1,6 +1,5 @@ --- import { timeAgo } from "@guardian/libs"; -// workaround for buggy import.meta in SSR build (https://github.com/withastro/astro/issues/2903) const CAPI_KEY = import.meta.env.CAPI_KEY ?? "test"; type SeriesResult = {