Loading...
Loading...
Read a public environment variable by key, returning a typed copy of its value. Throws if no public environment is available - i.e. the project defines no #[ossido::Environment] struct (the Rust equivalent, get_env!, is a compile error in that case) - or if the key is not a known public variable.
Only `#[public]` fields are available, and their types are generated into `.ossido/types.ts`, so keys and value types are checked. `getEnv` works during SSR and on the client.
A second argument is a fallback that collapses an optional value to a concrete `T`. It's returned whenever the value is absent (an optional variable unset, or no public environment available), so this form never throws: