From 1e8ffae5fd4c6039d8ae64b0aba0f45edc928bb1 Mon Sep 17 00:00:00 2001 From: Aditya Date: Wed, 31 Jan 2024 08:51:55 +0530 Subject: [PATCH] website: dev mode to run without liveblock api key --- website/liveblocks.config.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/website/liveblocks.config.ts b/website/liveblocks.config.ts index 824bd6e0b2..c269df0abf 100644 --- a/website/liveblocks.config.ts +++ b/website/liveblocks.config.ts @@ -2,10 +2,18 @@ import { createClient } from '@liveblocks/client'; import { createRoomContext } from '@liveblocks/react'; import type { JsonObject } from '@liveblocks/client'; +const isDevelopment: boolean = process.env.NODE_ENV === 'development'; + const client = createClient({ throttle: 16, - publicApiKey: process.env.NEXT_PUBLIC_LIVEBLOCKS_PUBLIC_KEY!, + publicApiKey: isDevelopment + ? 'pk_mock-api-key' + : process.env.NEXT_PUBLIC_LIVEBLOCKS_PUBLIC_KEY!, }); +if (isDevelopment) { + // eslint-disable-next-line no-console + console.warn('Development mode: using mock API key'); +} interface Presence extends JsonObject { cursor: { x: number; y: number } | null; }