Crates.io | const-dotenvy |
lib.rs | const-dotenvy |
version | 0.1.0 |
created_at | 2025-08-23 07:43:47.104834+00 |
updated_at | 2025-08-23 07:43:47.104834+00 |
description | A proc-macro to load .env variables at compile time using dotenvy |
homepage | https://github.com/Luro02/const-dotenvy |
repository | |
max_upload_size | |
id | 1807294 |
size | 10,890 |
A rust crate to read environment variables at compile-time and embed them into the code.
For example:
let (host, port, use_tls): (&'static str, u16, bool) = const_dotenvy::dotenvy!(
HOST: &'static str,
PORT: u16 = 8080,
USE_TLS: bool = false
);
will become
let (host, port, use_tls): (&'static str, u16, bool) = ("localhost", 8080, false);
It uses dotenvy
crate to read the environment file located in the source folder at compile-time, then expands to the read value.