Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unsure how to handle env variables #4

Open
shahzeb1 opened this issue Nov 29, 2023 · 1 comment
Open

Unsure how to handle env variables #4

shahzeb1 opened this issue Nov 29, 2023 · 1 comment

Comments

@shahzeb1
Copy link

It'd be really helpful if the docs mentioned how to use env vars.
I can confirm that without this library, env.SOME_KEY does logged, however, as soon as I export router then the env item in my handler callback doesn't have that value.

Thanks for an awesome library btw.

@nounder
Copy link

nounder commented Mar 3, 2024

Access to environmental variables depends on runtime you are using. If you are using Cloudflare Workers, bindings and environmental variables should be available in handler context:

	.put('/:flow_id', async (req, ctx) => {
		ctx.env.KV

		return new JSONResponse({})
	})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants