const-dotenvy

Crates.ioconst-dotenvy
lib.rsconst-dotenvy
version0.1.0
created_at2025-08-23 07:43:47.104834+00
updated_at2025-08-23 07:43:47.104834+00
descriptionA proc-macro to load .env variables at compile time using dotenvy
homepagehttps://github.com/Luro02/const-dotenvy
repository
max_upload_size
id1807294
size10,890
Lucas (Luro02)

documentation

README

const-dotenvy

Crates.io: const-dotenvy Documentation

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.

Commit count: 0

cargo fmt