docs(oauth-providers): use process.env instead of Bun.env as default
Now Bun is not standard, so I think README should use process.env instead of Bun.env, so I replaced Bun.env to process.env in this PR.
But there is a difference between Bun.env and process.env, I also added note about Bun.
⚠️ No Changeset found
Latest commit: fba3d9e38d618aa39259294fb81df09aba940f43
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
Hi @euxn23
Regarding env variables, we can use the adapter helper:
https://hono.dev/docs/helpers/adapter#env
import { env } from 'hono/adapter'
app.get('/env', (c) => {
// NAME is process.env.NAME on Node.js or Bun
// NAME is the value written in `wrangler.toml` on Cloudflare
const { NAME } = env<{ NAME: string }>(c)
return c.text(NAME)
})
I think using this would be better than using other runtime-specific variables.
Hi @euxn23
Regarding env variables, we can use the adapter helper:
https://hono.dev/docs/helpers/adapter#env
import { env } from 'hono/adapter' app.get('/env', (c) => { // NAME is process.env.NAME on Node.js or Bun // NAME is the value written in `wrangler.toml` on Cloudflare const { NAME } = env<{ NAME: string }>(c) return c.text(NAME) })I think using this would be better than using other runtime-specific variables.
But env() requires a c: Context param, which we cannot get out of a handler.
the same question in #398
Hi @nick-cjyx9
But
env()requires ac: Contextparam, which we cannot get out of a handler.
You are right. If you want to use environment variables out of a handler, you have to use Bun.env, process.env, or another runtime-dependent variable. In this case, it will be used in the middleware handler, so we have to use env().
Hi @euxn23
Regarding env variables, we can use the adapter helper:
https://hono.dev/docs/helpers/adapter#env
import { env } from 'hono/adapter' app.get('/env', (c) => { // NAME is process.env.NAME on Node.js or Bun // NAME is the value written in `wrangler.toml` on Cloudflare const { NAME } = env<{ NAME: string }>(c) return c.text(NAME) })I think using this would be better than using other runtime-specific variables.
Is there any way to have env() automatically parse the .env file and generate types?