-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feature-flag-hypertune] Update
@vercel/flags
for Hypertune (#880)
### Description Follow up to #871 Updates `@vercel/flags` for the Hypertune example
- Loading branch information
Showing
6 changed files
with
20 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 8 additions & 7 deletions
15
edge-middleware/feature-flag-hypertune/app/.well-known/vercel/flags/route.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import { NextResponse } from 'next/server' | ||
import { encryptApiData } from '@vercel/flags' | ||
import { vercelFlagDefinitions } from '../../../../generated/generated' | ||
import { type NextRequest, NextResponse } from 'next/server'; | ||
import { verifyAccess, type ApiData } from '@vercel/flags'; | ||
import { vercelFlagDefinitions } from '../../../../generated/generated'; | ||
|
||
export async function GET() { | ||
const apiData = { definitions: vercelFlagDefinitions } | ||
const encryptedApiData = await encryptApiData(apiData) | ||
return NextResponse.json(encryptedApiData) | ||
export async function GET(request: NextRequest) { | ||
const access = await verifyAccess(request.headers.get('Authorization')); | ||
if (!access) return NextResponse.json(null, { status: 401 }); | ||
|
||
return NextResponse.json<ApiData>({ definitions: vercelFlagDefinitions }); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
edge-middleware/feature-flag-hypertune/lib/getVercelFlagOverrides.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.