compatibility_date = "2023-10-30"
send_metrics = false
node_compat = true
main = "src/worker.ts"
account_id = "xxx-xxx"
# Staging
[env.staging]
name = "api-staging"
workers_dev = true
vars = { ENVIRONMENT = "staging" }
routes = [{ pattern = "staging.example.app", custom_domain = true }]
d1_databases = [
{ binding = "DB", database_name = "db-staging", database_id = "xxx-xxx", migrations_dir = "migrations", preview_database_id = "DB_STAGING" },
]
# Production
[env.production]
name = "api-production"
workers_dev = false
vars = { ENVIRONMENT = "production" }
routes = [{ pattern = "example.app", custom_domain = false }]
d1_databases = [
{ binding = "DB", database_name = "db-production", database_id = "xxx-xxx", migrations_dir = "migrations", preview_database_id = "DB_PRODUCTION"},
]
[[d1_databases]]
binding = "DB"
database_name = "api-staging"
database_id = "xxx_xxx" # same as the staging database_id
migrations_dir = "migrations"
preview_database_id = "DB_LOCAL"
compatibility_date = "2023-10-30"
send_metrics = false
node_compat = true
main = "src/worker.ts"
account_id = "xxx-xxx"
# Staging
[env.staging]
name = "api-staging"
workers_dev = true
vars = { ENVIRONMENT = "staging" }
routes = [{ pattern = "staging.example.app", custom_domain = true }]
d1_databases = [
{ binding = "DB", database_name = "db-staging", database_id = "xxx-xxx", migrations_dir = "migrations", preview_database_id = "DB_STAGING" },
]
# Production
[env.production]
name = "api-production"
workers_dev = false
vars = { ENVIRONMENT = "production" }
routes = [{ pattern = "example.app", custom_domain = false }]
d1_databases = [
{ binding = "DB", database_name = "db-production", database_id = "xxx-xxx", migrations_dir = "migrations", preview_database_id = "DB_PRODUCTION"},
]
[[d1_databases]]
binding = "DB"
database_name = "api-staging"
database_id = "xxx_xxx" # same as the staging database_id
migrations_dir = "migrations"
preview_database_id = "DB_LOCAL"