-
Notifications
You must be signed in to change notification settings - Fork 29
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
ENV in Honox #79
Comments
Since HonoX is built on Vite, dotfiles should work fine. They can be accessed via the Context object within any route. export default createRoute(async (c) => {
console.log(c.env.DEBUG)
return c.html(<html>{c.env.DEBUG}</html>);
}); |
@bruceharrison1984 It did not seem to work without the adding the VITE_ prefix. What am I doing wrong? |
in my case, I'm doing it in vite config. not ideal but good enough for my use case export default defineConfig(async ({ command, mode }) => {
if (command === 'serve') {
await import('dotenv/config');
}
... |
@divofred If I am not mistaken, the |
Alright, thanks. @terenced |
What is the feature you are proposing?
I looked through the documentation and I did not see anywhere documenting how to use ENVs. I checked VITE and saw that I can use ENV by creating an
.env
file and adding theVITE_
prefix to the env name. SampleVITE_HELLO=WORLD
.Is this the best way or is there another?
The text was updated successfully, but these errors were encountered: