From e09a90837c1ef606a53824ef910a433ca6816778 Mon Sep 17 00:00:00 2001 From: Ugur Date: Mon, 9 Sep 2024 15:02:01 +0300 Subject: [PATCH 1/3] feat: Add requirement environment variables for Clerk and Stream Chat keys --- .env.template | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .env.template diff --git a/.env.template b/.env.template new file mode 100644 index 0000000..61713ac --- /dev/null +++ b/.env.template @@ -0,0 +1,4 @@ +NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY="YOUR_PUBLIC_CLERK_KEY" +CLERK_SECRET_KEY="YOUR_SECRET_CLERK_KEY" + +STREAM_CHAT_SECRET="YOUR_SECRET_STREAM_CHAT_KEY" \ No newline at end of file From d611b84c9cbd38a6f48597f672932ce31d7c5573 Mon Sep 17 00:00:00 2001 From: Ugur Date: Mon, 9 Sep 2024 15:03:13 +0300 Subject: [PATCH 2/3] chore: Update next.config.js with additional image hostnames as app do not run if someone log in with google --- next.config.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/next.config.js b/next.config.js index 81157cd..32ee7ec 100644 --- a/next.config.js +++ b/next.config.js @@ -30,6 +30,10 @@ const nextConfig = { protocol: 'https', hostname: 'starwars.fandom.com', }, + { + protocol: 'https', + hostname: 'lh3.googleusercontent.com', + }, ], }, }; From a095de6ec8897a055cfa6a58dd477e84b25b5bda Mon Sep 17 00:00:00 2001 From: Ugur Date: Mon, 9 Sep 2024 15:05:32 +0300 Subject: [PATCH 3/3] chore: add public environment for public stream key refactor: get public stream key from env variables --- .env.template | 2 ++ app/api/register-user/route.ts | 2 +- app/api/token/route.ts | 2 +- app/api/users/route.ts | 2 +- app/page.tsx | 2 +- 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.env.template b/.env.template index 61713ac..7e766a7 100644 --- a/.env.template +++ b/.env.template @@ -1,4 +1,6 @@ NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY="YOUR_PUBLIC_CLERK_KEY" CLERK_SECRET_KEY="YOUR_SECRET_CLERK_KEY" + +NEXT_PUBLIC_STREAM_PUBLIC_KEY="YOUR_PUBLIC_STREAM_CHAT_KEY" STREAM_CHAT_SECRET="YOUR_SECRET_STREAM_CHAT_KEY" \ No newline at end of file diff --git a/app/api/register-user/route.ts b/app/api/register-user/route.ts index d4de029..a4cdfaf 100644 --- a/app/api/register-user/route.ts +++ b/app/api/register-user/route.ts @@ -3,7 +3,7 @@ import { StreamChat } from 'stream-chat'; export async function POST(request: Request) { const serverClient = StreamChat.getInstance( - '7cu55d72xtjs', + process.env.NEXT_PUBLIC_STREAM_PUBLIC_KEY!, process.env.STREAM_CHAT_SECRET ); const body = await request.json(); diff --git a/app/api/token/route.ts b/app/api/token/route.ts index 2cdff20..d6abdcd 100644 --- a/app/api/token/route.ts +++ b/app/api/token/route.ts @@ -2,7 +2,7 @@ import { StreamChat } from 'stream-chat'; export async function POST(request: Request) { const serverClient = StreamChat.getInstance( - '7cu55d72xtjs', + process.env.NEXT_PUBLIC_STREAM_PUBLIC_KEY!, process.env.STREAM_CHAT_SECRET ); const body = await request.json(); diff --git a/app/api/users/route.ts b/app/api/users/route.ts index 2d83310..916ec53 100644 --- a/app/api/users/route.ts +++ b/app/api/users/route.ts @@ -3,7 +3,7 @@ import { StreamChat } from 'stream-chat'; export async function GET() { const serverClient = StreamChat.getInstance( - '7cu55d72xtjs', + process.env.NEXT_PUBLIC_STREAM_PUBLIC_KEY!, process.env.STREAM_CHAT_SECRET ); const response = await serverClient.queryUsers({}); diff --git a/app/page.tsx b/app/page.tsx index 8e6f070..35f7cda 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -10,7 +10,7 @@ import MyChat from '@/components/MyChat'; // const userId = '7cd445eb-9af2-4505-80a9-aa8543c3343f'; // const userName = 'Harry Potter'; -const apiKey = '7cu55d72xtjs'; +const apiKey = process.env.NEXT_PUBLIC_STREAM_PUBLIC_KEY! // const userToken = // 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2NkNDQ1ZWItOWFmMi00NTA1LTgwYTktYWE4NTQzYzMzNDNmIn0.TtrCA5VoRB2KofI3O6lYjYZd2pHdQT408u7ryeWO4Qg';