Remove unused old env var (#41178)

* Remove unused old env var

* Update apps/studio/lib/api/apiHelpers.ts

Co-authored-by: Alaister Young <alaister@users.noreply.github.com>

* Fix

* Add comment

---------

Co-authored-by: Alaister Young <alaister@users.noreply.github.com>
This commit is contained in:
Joshen LimandAlaister Young authored and GitHub committed 2025-12-09 13:22:10 +08:00
1 parent 6b2d789284
commit 91209faab1
3 files changed
+3 -7

No files matched your search

-1
View File
@@ -15,7 +15,6 @@ vi.mock('lib/constants', () => ({
describe('apiHelpers', () => {
describe('constructHeaders', () => {
beforeEach(() => {
process.env.READ_ONLY_API_KEY = 'test-readonly-key'
process.env.SUPABASE_SERVICE_KEY = 'test-service-key'
})
+3 -3
View File
@@ -25,9 +25,9 @@ export function constructHeaders(headers: { [prop: string]: any }) {
)
return {
...cleansedHeaders,
...(IS_PLATFORM
? { apiKey: `${process.env.READ_ONLY_API_KEY}` }
: { apiKey: `${process.env.SUPABASE_SERVICE_KEY}` }),
// [Joshen] JFYI both Alaister and I checked on this and realised this might not be used actually
// Could be safe to remove but leaving it here for now
...(!IS_PLATFORM && { apiKey: `${process.env.SUPABASE_SERVICE_KEY}` }),
}
} else {
return {
@@ -1,12 +1,9 @@
import { createClient } from '@supabase/supabase-js'
import { NextApiRequest, NextApiResponse } from 'next'
import { fetchPost } from 'data/fetchers'
import { constructHeaders } from 'lib/api/apiHelpers'
import apiWrapper from 'lib/api/apiWrapper'
const supabase = createClient(process.env.SUPABASE_URL!, process.env.SUPABASE_SERVICE_KEY!)
export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler)
async function handler(req: NextApiRequest, res: NextApiResponse) {