Replies: 1 comment 4 replies
-
If you are only using CSR, and serving static HTML/JS/WASM, the only Rust binary that is running for your application is running in the user's browser, and doesn't have access to environment variables (let alone environment variables on your server). Am I misunderstanding something about your situation? |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I have a server side rendered and client side rendered application and I would like to read from
std::env::var(...)
once booting up. The idea behind that is, that urls aren't hard coded and can be loaded with an environment variable. For example deployment on a production and staging environment. Right now the only proper way to do ist is building two docker container and use the compile time macrostd::env!
. This isn't ideal, because you need to hardbake the endpoints to the docker container and build it twice. The idea would be to read thestd::env::var
on booting up and use that to serve it. In#[server] functions
it's possible to access thestd::env::var
, but it's not possible to provide environment variables outside of server functions. Does someone have a good idea how we could access env variables inside the CSR functions?Beta Was this translation helpful? Give feedback.
All reactions