diff --git a/frontend/db/index.ts b/frontend/db/index.ts index cb9b681e..5e76ca23 100644 --- a/frontend/db/index.ts +++ b/frontend/db/index.ts @@ -13,21 +13,19 @@ type AppDatabase = PgDatabase; const APP_ENV = process.env.APP_ENV?.trim().toLowerCase(); -if (!APP_ENV) { - throw new Error( - '[db] APP_ENV is required. Set APP_ENV=local in .env for development, or APP_ENV=develop/production for deployment' - ); -} - -const IS_LOCAL_ENV = APP_ENV === 'local'; - if (process.env.NODE_ENV !== 'test') { console.log('[db] runtime env check', { + APP_ENV: process.env.APP_ENV ?? '', has_DATABASE_URL: Boolean(process.env.DATABASE_URL?.trim()), has_DATABASE_URL_LOCAL: Boolean(process.env.DATABASE_URL_LOCAL?.trim()), + NETLIFY: process.env.NETLIFY ?? '', + CONTEXT: process.env.CONTEXT ?? '', + NODE_ENV: process.env.NODE_ENV ?? '', }); } +const IS_LOCAL_ENV = APP_ENV === 'local'; + const STRICT_LOCAL_DB_GUARD = process.env.SHOP_STRICT_LOCAL_DB === '1'; const REQUIRED_LOCAL_DB_URL = process.env.SHOP_REQUIRED_DATABASE_URL_LOCAL; diff --git a/frontend/db/queries/categories/admin-categories.ts b/frontend/db/queries/categories/admin-categories.ts index 2e92e358..cbc2bf6a 100644 --- a/frontend/db/queries/categories/admin-categories.ts +++ b/frontend/db/queries/categories/admin-categories.ts @@ -29,7 +29,7 @@ export async function getAdminCategoryList(): Promise { return rows.map(row => ({ id: row.id, slug: row.slug, - title: row.title ?? row.slug, + title: row.title?.trim() || row.slug })); } diff --git a/frontend/next.config.ts b/frontend/next.config.ts index 017c8b8c..a4b22934 100644 --- a/frontend/next.config.ts +++ b/frontend/next.config.ts @@ -5,6 +5,10 @@ import createNextIntlPlugin from 'next-intl/plugin'; const withNextIntl = createNextIntlPlugin('./i18n/request.ts'); const nextConfig: NextConfig = { + env: { + APP_ENV: process.env.APP_ENV, + DATABASE_URL: process.env.DATABASE_URL, + }, images: { remotePatterns: [ { diff --git a/frontend/vitest.config.ts b/frontend/vitest.config.ts index 5c42afa4..3f49e0ab 100644 --- a/frontend/vitest.config.ts +++ b/frontend/vitest.config.ts @@ -13,6 +13,9 @@ export default defineConfig({ }, }, test: { + env: { + APP_ENV: 'local', + }, environment: 'node', include: [ 'lib/tests/**/*.test.ts', diff --git a/frontend/vitest.shop.config.ts b/frontend/vitest.shop.config.ts index 9ecb7b5f..8cc77d6b 100644 --- a/frontend/vitest.shop.config.ts +++ b/frontend/vitest.shop.config.ts @@ -13,6 +13,9 @@ export default defineConfig({ }, }, test: { + env: { + APP_ENV: 'local', + }, environment: 'node', include: ['lib/tests/shop/**/*.test.ts'], globals: true, diff --git a/netlify.toml b/netlify.toml index c1dadc68..a7c4d600 100644 --- a/netlify.toml +++ b/netlify.toml @@ -3,9 +3,6 @@ command = "npm ci --include=optional && npm run build" publish = ".next" -[functions] - node_bundler = "esbuild" - [build.environment] NODE_VERSION = "20.19.0"