fix cf deployment
This commit is contained in:
1 parent
2d919420d5
commit
47157fd5e7
2 files changed
+9
-2
No files matched your search
@@ -2,9 +2,12 @@ import { eq } from "drizzle-orm";
|
||||
import { getDb } from "@/db";
|
||||
import { appSettings } from "@/db/schema";
|
||||
import { APP_SETTINGS_ID } from "@/lib/branding/service";
|
||||
import { getEnv } from "@/lib/cloudflare";
|
||||
import { getEnvAsync } from "@/lib/cloudflare";
|
||||
import { getLicenseEntitlements } from "@/lib/licenses/service";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
export const revalidate = 0;
|
||||
|
||||
async function getDefaultIcon(env: CloudflareEnv): Promise<Response> {
|
||||
const asset = await env.ASSETS.fetch("https://mailflare.local/icon-96.png");
|
||||
return new Response(await asset.arrayBuffer(), {
|
||||
@@ -15,7 +18,7 @@ async function getDefaultIcon(env: CloudflareEnv): Promise<Response> {
|
||||
}
|
||||
|
||||
export async function GET(request: Request) {
|
||||
const env = getEnv();
|
||||
const env = await getEnvAsync();
|
||||
if (!(await getLicenseEntitlements(env)).canCustomizeBranding) return getDefaultIcon(env);
|
||||
try {
|
||||
const [settings] = await getDb(env)
|
||||
|
||||
@@ -3,3 +3,7 @@ import { getCloudflareContext } from "@opennextjs/cloudflare";
|
||||
export function getEnv(): CloudflareEnv {
|
||||
return getCloudflareContext().env as CloudflareEnv;
|
||||
}
|
||||
|
||||
export async function getEnvAsync(): Promise<CloudflareEnv> {
|
||||
return (await getCloudflareContext({ async: true })).env as CloudflareEnv;
|
||||
}
|
||||
Reference in new issue
Block a user