/**
 * For more details on how to configure Wrangler, refer to:
 * https://developers.cloudflare.com/workers/wrangler/configuration/
 */
{
  "$schema": "node_modules/wrangler/config-schema.json",
  "main": ".open-next/worker.js",
  "name": "mksaas-template",
  "compatibility_date": "2024-12-30",
  "compatibility_flags": [
    // Enable Node.js API
    // see https://developers.cloudflare.com/workers/configuration/compatibility-flags/#nodejs-compatibility-flag
    "nodejs_compat",
    // This also enables nodejs_compat_v2 as long as compatibility date is 2024-09-23 or later.
    // https://developers.cloudflare.com/workers/configuration/compatibility-dates/#nodejs-compatibility-flag
    // Enable improved Node.js API with polyfills and native code
    // see https://blog.cloudflare.com/zh-cn/more-npm-packages-on-cloudflare-workers-combining-polyfills-and-native-code/
    // "nodejs_compat_v2",
    // Enable auto-populating process.env
    // see https://developers.cloudflare.com/workers/configuration/compatibility-flags/#enable-auto-populating-processenv
    "nodejs_compat_populate_process_env",
    // Allow to fetch URLs in your app
    // see https://developers.cloudflare.com/workers/configuration/compatibility-flags/#global-fetch-strictly-public
    "global_fetch_strictly_public"
  ],
  // Minification helps to keep the Worker bundle size down and improve start up time.
  "minify": true,

  // Enables Workers Trace Events Logpush for a Worker
  "logpush": true,

  // https://developers.cloudflare.com/workers/wrangler/configuration/#top-level-only-keys
  // Whether Wrangler should keep variables configured in the dashboard on deploy
  "keep_vars": true,

  "assets": {
    "binding": "ASSETS",
    "directory": ".open-next/assets"
  },

  // https://developers.cloudflare.com/workers/wrangler/configuration/#observability
  "observability": {
    "enabled": true
  },

  /**
   * Smart Placement
   * Docs: https://developers.cloudflare.com/workers/configuration/smart-placement/#smart-placement
   */
  // "placement": { "mode": "smart" },

  /**
   * Bindings
   * Bindings allow your Worker to interact with resources on the Cloudflare Developer Platform, including
   * databases, object storage, AI inference, real-time communication and more.
   * https://developers.cloudflare.com/workers/runtime-apis/bindings/
   */

  /**
   * Hyperdrive
   * https://opennext.js.org/cloudflare/howtos/db#hyperdrive-example
   * https://developers.cloudflare.com/workers/tutorials/postgres/#8-use-hyperdrive-to-accelerate-queries
   */
  "hyperdrive": [
    {
      "binding": "HYPERDRIVE",
      "id": "8ba4508b28cf42f987f3533c1f09433c",
      "localConnectionString": "postgresql://postgres:postgres@localhost:5432/postgres"
    }
  ],

  /**
   * Environment Variables
   * https://developers.cloudflare.com/workers/wrangler/configuration/#environment-variables
   */
  "vars": {},

  /**
   * Note: Use secrets to store sensitive data.
   * https://developers.cloudflare.com/workers/configuration/secrets/
   */

  "kv_namespaces": []
}
