Skip to content

Macro alternative to fallback to regular env #76

@ShayBox

Description

@ShayBox

I use dotenvy! for development to load from .env and env! in production to load from regular env (GitHub Workflows), now I have a feature flag to switch between the two but it's very inconvenient and repetitive.

#[cfg(feature = "production")]
const EXAMPLE_ENV: &str = dotenv!("EXAMPLE_ENV");
#[cfg(not(feature = "production"))]
const EXAMPLE_ENV: &str = env!("EXAMPLE_ENV");

Having a macro that falls back to the regular env would be nice.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions