fix: load dynamic config

This commit is contained in:
shinya
2025-06-30 10:08:54 +08:00
parent 5c8360d9dd
commit 99d15544a4
7 changed files with 19 additions and 22 deletions

View File

@@ -185,7 +185,7 @@ async function getVideoDetail(
return getDetailFromApi(apiSite, id);
}
export const runtime = 'edge';
export const runtime = process.env.DOCKER_ENV === 'true' ? 'node' : 'edge';
export async function GET(request: Request) {
const { searchParams } = new URL(request.url);

View File

@@ -43,7 +43,7 @@ async function fetchDoubanData(url: string): Promise<DoubanApiResponse> {
}
}
export const runtime = 'edge';
export const runtime = process.env.DOCKER_ENV === 'true' ? 'node' : 'edge';
export async function GET(request: Request) {
const { searchParams } = new URL(request.url);

View File

@@ -1,6 +1,6 @@
import { NextRequest, NextResponse } from 'next/server';
export const runtime = 'edge';
export const runtime = process.env.DOCKER_ENV === 'true' ? 'node' : 'edge';
export async function POST(req: NextRequest) {
try {

View File

@@ -5,7 +5,7 @@ import { NextRequest, NextResponse } from 'next/server';
import { db } from '@/lib/db';
import { PlayRecord } from '@/lib/db';
export const runtime = 'edge';
export const runtime = process.env.DOCKER_ENV === 'true' ? 'node' : 'edge';
export async function GET() {
try {

View File

@@ -4,7 +4,7 @@ import { API_CONFIG, ApiSite, getApiSites, getCacheTime } from '@/lib/config';
import { SearchResult } from '@/lib/types';
import { cleanHtmlTags } from '@/lib/utils';
export const runtime = 'edge';
export const runtime = process.env.DOCKER_ENV === 'true' ? 'node' : 'edge';
// 根据环境变量决定最大搜索页数,默认 5
const MAX_SEARCH_PAGES: number =