From 600017fca82e35b0bb7c9792e6f1cc9e36cd43e5 Mon Sep 17 00:00:00 2001 From: Oliver Dunk Date: Fri, 20 Dec 2024 19:52:52 +0000 Subject: [PATCH] Add environment variable for configuring storage bucket (#1372) Adds the STORAGE_BUCKET environment variable which is used for determining which bucket the prepare-chrome-types script loads type data from. --- .repo/sample-list-generator/src/prepare-chrome-types.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.repo/sample-list-generator/src/prepare-chrome-types.ts b/.repo/sample-list-generator/src/prepare-chrome-types.ts index d735c8d91b..72e354f1d6 100644 --- a/.repo/sample-list-generator/src/prepare-chrome-types.ts +++ b/.repo/sample-list-generator/src/prepare-chrome-types.ts @@ -4,12 +4,19 @@ import fs from 'fs/promises'; import { ExtensionApiMap } from './types'; import { ReflectionKind } from 'typedoc'; +// Bucket used to store processed types data +const STORAGE_BUCKET = process.env.STORAGE_BUCKET; + // Fetch the latest version of the chrome types from storage const fetchChromeTypes = async (): Promise> => { + if (!STORAGE_BUCKET) { + throw new Error('The STORAGE_BUCKET environment variable must be set.'); + } + console.log('Fetching chrome types...'); const response = await fetch( - 'https://storage.googleapis.com/download/storage/v1/b/external-dcc-data/o/chrome-types.json?alt=media' + `https://storage.googleapis.com/download/storage/v1/b/${STORAGE_BUCKET}/o/chrome-types.json?alt=media` ); const chromeTypes = await response.json(); return chromeTypes;