- Updated package.json to use npx for deploying and developing, and upgraded several dependencies including vitest and wrangler. - Renamed the project in wrangler.jsonc to include the year 2026 and added new routes and triggers for scheduled tasks. - Enhanced the API by adding new reload endpoints for pages, blogs, projects, and experiences, with appropriate CORS handling. - Implemented checks in import functions for files, images, and videos to skip updates if no changes are detected. - Improved error handling and logging across various routes and utilities. - Refactored global headers to dynamically resolve CORS origins based on incoming requests.
167 lines
5.5 KiB
JSON
167 lines
5.5 KiB
JSON
/**
|
||
* For more details on how to configure Wrangler, refer to:
|
||
* https://developers.cloudflare.com/workers/wrangler/configuration/
|
||
*/
|
||
{
|
||
"$schema": "node_modules/wrangler/config-schema.json",
|
||
"name": "tombutcher-api-2026",
|
||
"main": "src/index.js",
|
||
"compatibility_date": "2025-02-24",
|
||
"observability": {
|
||
"enabled": true,
|
||
"head_sampling_rate": 1
|
||
},
|
||
"routes": [
|
||
{
|
||
"pattern": "api2026.tombutcher.work",
|
||
"custom_domain": 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/
|
||
*/
|
||
|
||
"triggers": {
|
||
"crons": ["*/5 * * * *"]
|
||
},
|
||
/**
|
||
* Environment Variables
|
||
* https://developers.cloudflare.com/workers/wrangler/configuration/#environment-variables
|
||
*/
|
||
"vars": {
|
||
"THEMES_DB": "289dd26d-60b6-8195-843b-000b65b97c0a",
|
||
"GLOBAL_THEMES_DB": "289dd26d-60b6-81d8-8823-000b24e2a783",
|
||
"PAGES_DB": "289dd26d-60b6-81d0-b598-000becb15373",
|
||
"BLOGS_DB": "289dd26d-60b6-811d-9bdb-000bc5557136",
|
||
"MESSAGES_DB": "289dd26d-60b6-818e-9f49-000b5fb2ba34",
|
||
"REDIRECTS_DB": "289dd26d-60b6-817c-9f97-000ba041fcfb",
|
||
"PROJECTS_DB": "297dd26d-60b6-8031-9de2-000bb1de652b",
|
||
"COMPANIES_DB": "29fdd26d-60b6-80e8-8b70-000b0c24c7b7",
|
||
"POSITIONS_DB": "29fdd26d-60b6-8018-9fd5-000bdce63f48",
|
||
"DEVELOPERS_DB": "2a6dd26d-60b6-8041-9dc3-000bf09477ed",
|
||
"CV_DB": "2a3dd26d-60b6-8098-85c0-000b12e171c4",
|
||
"BLOGS_KEY": "tb-blogs-cache",
|
||
"COMPANIES_KEY": "tb-companies-cache",
|
||
"POSITIONS_KEY": "tb-positions-cache",
|
||
"NAVIGATION_KEY": "tb-navigation-cache",
|
||
"PAGES_KEY": "tb-pages-cache",
|
||
"IMAGES_KEY": "tb-images-cache",
|
||
"BOOKINGS_KEY": "tb-bookings-cache",
|
||
"PROJECTS_KEY": "tb-projects-cache",
|
||
"VIDEOS_KEY": "tb-videos-cache",
|
||
"FILES_KEY": "tb-files-cache",
|
||
"PROPERTIES_KEY": "tb-properties-cache",
|
||
"SETTINGS_KEY": "tb-settings-cache",
|
||
"CV_KEY": "tb-cv-cache",
|
||
"CACHE_URL": "https://api.tombutcherltd.com/cache",
|
||
"R2_PUBLIC_URL": "https://cdn2026.tombutcher.work",
|
||
"BLUR_HASH": "false",
|
||
"CORS_ORIGIN": [
|
||
"https://tombutcher.work",
|
||
"https://2026.tombutcher.work",
|
||
"https://api2026.tombutcher.work"
|
||
]
|
||
},
|
||
|
||
"kv_namespaces": [
|
||
{
|
||
"binding": "CONTENT_KV", // the variable you’ll use in the Worker
|
||
"id": "1cffbf98b6e24fd3a58d5f484ecb12ef" // ID from Cloudflare dashboard
|
||
}
|
||
],
|
||
"r2_buckets": [
|
||
{
|
||
"binding": "TB_STORAGE",
|
||
"bucket_name": "tb-2026-storage"
|
||
}
|
||
],
|
||
"images": {
|
||
"binding": "IMAGES" // i.e. available in your Worker on env.IMAGES
|
||
},
|
||
|
||
"env": {
|
||
"production": {
|
||
"kv_namespaces": [
|
||
{
|
||
"binding": "CONTENT_KV", // the variable you’ll use in the Worker
|
||
"id": "1cffbf98b6e24fd3a58d5f484ecb12ef" // ID from Cloudflare dashboard
|
||
}
|
||
],
|
||
"r2_buckets": [
|
||
{
|
||
"binding": "TB_STORAGE",
|
||
"bucket_name": "tb-2026-storage"
|
||
}
|
||
],
|
||
"images": {
|
||
"binding": "IMAGES" // i.e. available in your Worker on env.IMAGES
|
||
},
|
||
"vars": {
|
||
"THEMES_DB": "289dd26d-60b6-8195-843b-000b65b97c0a",
|
||
"GLOBAL_THEMES_DB": "289dd26d-60b6-81d8-8823-000b24e2a783",
|
||
"PAGES_DB": "289dd26d-60b6-81d0-b598-000becb15373",
|
||
"BLOGS_DB": "289dd26d-60b6-811d-9bdb-000bc5557136",
|
||
"MESSAGES_DB": "289dd26d-60b6-818e-9f49-000b5fb2ba34",
|
||
"REDIRECTS_DB": "289dd26d-60b6-817c-9f97-000ba041fcfb",
|
||
"PROJECTS_DB": "297dd26d-60b6-8031-9de2-000bb1de652b",
|
||
"COMPANIES_DB": "29fdd26d-60b6-80e8-8b70-000b0c24c7b7",
|
||
"POSITIONS_DB": "29fdd26d-60b6-8018-9fd5-000bdce63f48",
|
||
"DEVELOPERS_DB": "2a6dd26d-60b6-8041-9dc3-000bf09477ed",
|
||
"CV_DB": "2a3dd26d-60b6-8098-85c0-000b12e171c4",
|
||
"BLOGS_KEY": "tb-blogs-cache",
|
||
"COMPANIES_KEY": "tb-companies-cache",
|
||
"POSITIONS_KEY": "tb-positions-cache",
|
||
"NAVIGATION_KEY": "tb-navigation-cache",
|
||
"PAGES_KEY": "tb-pages-cache",
|
||
"IMAGES_KEY": "tb-images-cache",
|
||
"BOOKINGS_KEY": "tb-bookings-cache",
|
||
"PROJECTS_KEY": "tb-projects-cache",
|
||
"VIDEOS_KEY": "tb-videos-cache",
|
||
"FILES_KEY": "tb-files-cache",
|
||
"PROPERTIES_KEY": "tb-properties-cache",
|
||
"SETTINGS_KEY": "tb-settings-cache",
|
||
"CV_KEY": "tb-cv-cache",
|
||
"CACHE_URL": "https://api2026.tombutcher.work/cache",
|
||
"R2_PUBLIC_URL": "https://cdn2026.tombutcher.work",
|
||
"BLUR_HASH": "true",
|
||
"CORS_ORIGIN": [
|
||
"https://tombutcher.work",
|
||
"https://2026.tombutcher.work",
|
||
"https://api2026.tombutcher.work"
|
||
]
|
||
}
|
||
}
|
||
},
|
||
|
||
/**
|
||
* Note: Use secrets to store sensitive data.
|
||
* https://developers.cloudflare.com/workers/configuration/secrets/
|
||
*/
|
||
|
||
/**
|
||
* Static Assets
|
||
* https://developers.cloudflare.com/workers/static-assets/binding/
|
||
*/
|
||
// "assets": { "directory": "./public/", "binding": "ASSETS" },
|
||
|
||
/**
|
||
* Service Bindings (communicate between multiple Workers)
|
||
* https://developers.cloudflare.com/workers/wrangler/configuration/#service-bindings
|
||
*/
|
||
// "services": [{ "binding": "MY_SERVICE", "service": "my-service" }]
|
||
|
||
"dev": {
|
||
"ip": "0.0.0.0",
|
||
"port": 8787
|
||
}
|
||
}
|