Skip to content

Configurable DATABASE_URL environment key for SQLx macros #3494

Closed
@dnlsndr

Description

@dnlsndr

Is your feature request related to a problem? Please describe.
At the moment, SQLx live query checks rely on the DATABASE_URL environment variable, which is hardcoded in the macro code. This causes issues when building out more complex systems, where environment variables are automaticelly separated by underscores and parsed into configuration structs and other advanced features that may collide with this fixed env variable.

Describe the solution you'd like
I propose a way that allows us to configure how this environment variable is named,
maybe through a configuration parameter int the Cargo.toml or via a separate environment variable called something like SQLX_DATABASE_URL_ENVIRONMENT_KEY

Describe alternatives you've considered
There are no alternatives available that allow me to change the environment variable, other than forking the whole crate.

Additional context
I'd be happy to create a PR for this

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions