Expand description
A procedural macro to read environment variables at compile-time and embed them as expressions in the code.
This is useful for embedding configuration values in the environments where you can’t read a .env file at
runtime, for example on an esp32 microcontroller.
§Example
use const_dotenvy::dotenvy;
let (host, port, use_tls): (&str, u16, bool) = dotenvy!(
HOST: &'static str,
PORT: u16 = 8080,
USE_TLS: bool = false
);
assert_eq!(host, "localhost");
assert_eq!(port, 8080);
assert_eq!(use_tls, false);Macros§
- dotenvy
- This macro reads environment variables at compile-time from the
.envfile or optionally from the environment, then emits a literal containing the value. You can specify a type and a default value, if the variable is optional.