Or if it is supposed to be a secret, you can use a `.dev.vars` file
Or if it is supposed to be a secret, you can use a
.dev.vars file.dev.varsaddEventListener_routes.json (https://developers.cloudflare.com/pages/functions/routing/#create-a-_routesjson-file) is supported in Functions Advanced mode ?./_worker.js folder with a index.ts seems to be automatically transpiled and it works. But is this expected behavior?
functions: wuz hereaddEventListenerAdvanced mode./_worker.jsexport async function onRequestGet(context) {
console.log('Inside index.html proxy function ..')
return context.next()
}functions: wuz herename = "name"
pages_build_output_dir = "./dist"
compatibility_date = "2023-10-21"
compatibility_flags = ["nodejs_compat"]
[vars]
STRIPE_PUBLISHABLE_KEY = "sdfsf"
STRIPE_SECRET_KEY = "sdfsfds"
STRIPE_WEBHOOK_SECRET = "asdad"
[env.production.vars]
STRIPE_PUBLISHABLE_KEY = "sdfsf"
STRIPE_SECRET_KEY = "sdfsfds"
STRIPE_WEBHOOK_SECRET = "asdad"addEventListener('fetch', event => {
event.respondWith(onRequestGet(event))
})
export async function onRequestGet(event) {
const { env } = event
// other code
}addEventListener('fetch', event => {
event.respondWith(onRequestPost(event.request, event.env))
})
export async function onRequestGet(req,env) {
const requestBody = await req.json();
const key = env.STRIPE_SECRET_KEY;
// other code
}addEventListener('fetch', event => {
event.respondWith(onRequestPost(event))
})
export async function onRequestGet(event) {
const { request, env } = event;
const requestBody = await request.json();
const key = env.STRIPE_SECRET_KEY;
// other code
}