Skip to content

Make compile-time macros configurable with path#159

Open
Juliapixel wants to merge 6 commits intoallan2:mainfrom
Juliapixel:feat/codegen_attrs
Open

Make compile-time macros configurable with path#159
Juliapixel wants to merge 6 commits intoallan2:mainfrom
Juliapixel:feat/codegen_attrs

Conversation

@Juliapixel
Copy link
Copy Markdown

Overview

This PR adds path and override_ attributes to the dotenvy_macro::dotenv macro (as determined in #128), as well as a new option_dotenv macro, as it makes the API more consistent with the existing env and option_env macros in the standard library (as suggested in #85).

All changes made are also backwards compatible with the previous version of the crate.

Closes #128

Examples

const VAR: &str = dotenvy_macro::dotenv!("ENV_VAR", path = ".env.example")
const MAYBE_VAR: Option<&str> = dotenvy_macro::option_dotenv!("ANOTHER_ENV_VAR", override_ = false, path = ".env.example")

@Laurence-Cullen
Copy link
Copy Markdown

This would be amazing for me 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Compile-time macro should be configurable with path

2 participants