From b0d08393917254edaec6a82340981903b4dd32ae Mon Sep 17 00:00:00 2001 From: KazooTTT Date: Thu, 30 Jan 2025 20:36:06 +0800 Subject: [PATCH] chore: use env --- astro.config.mjs | 9 +-------- wrangler.toml | 7 ++++++- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/astro.config.mjs b/astro.config.mjs index 8c78da1..c9124c1 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -19,14 +19,7 @@ export default defineConfig({ mode: 'directory', runtime: { mode: process.env.NODE_ENV === 'production' ? 'off' : 'local', - persistTo: process.env.NODE_ENV === 'production' ? undefined : '.wrangler/state/v3/d1', - bindings: { - DB: { - type: 'd1', - databaseName: 'blog-pageviews', - databaseId: 'ab9e5f7d-e254-4e7d-bd85-5d944a622682' - } - } + persistTo: process.env.NODE_ENV === 'production' ? undefined : '.wrangler/state/v3/d1' } }), redirects: { diff --git a/wrangler.toml b/wrangler.toml index c82b1cd..055acad 100644 --- a/wrangler.toml +++ b/wrangler.toml @@ -9,4 +9,9 @@ format = "directory" [site] bucket = "./dist" -pages_build_output_dir = "dist" \ No newline at end of file +pages_build_output_dir = "dist" + +[[d1_databases]] +binding = "DB" +database_name = "blog-pageviews" +database_id = "${D1_DATABASE_ID}" \ No newline at end of file