-
Hi!
What am I missing? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
You can access these env vars on the server (e.g., Axum) when using Dioxus full-stack, but not on the client side (Dioxus Web) in the browser. I had the same question while building this full-stack blog app. I needed a way to set the admin email and password in the environment variables. Then I realized I could check the user's role for login, setting it to 'admin' by manually updating the role in MongoDB from the default 'user' to 'admin.' Edit: |
Beta Was this translation helpful? Give feedback.
-
Was taken up in the issue as well with some code snippets. |
Beta Was this translation helpful? Give feedback.
You can access these env vars on the server (e.g., Axum) when using Dioxus full-stack, but not on the client side (Dioxus Web) in the browser. I had the same question while building this full-stack blog app. I needed a way to set the admin email and password in the environment variables. Then I realized I could check the user's role for login, setting it to 'admin' by manually updating the role in MongoDB from the default 'user' to 'admin.'
Edit:
dotenv
sets env vars at runtime and can't be accessed from WASM env. Try using thestd::env
macro to access these env vars at compile time, wasm.