Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Determine database_url when first accessed versus when required #88

Merged
merged 1 commit into from
Jan 30, 2024

Conversation

Blacksmoke16
Copy link
Contributor

@Blacksmoke16 Blacksmoke16 commented Aug 11, 2023

Changes how the DATABASE_URL ENV var is loaded so that the value is determined when first used instead of when micrate itself is required. Removes the need to manually overwrite the connection URL if the ENV var is not immediately available. E.g. when set via a dotenv shard.

Before:

ENV["DATABASE_URL"] = "FOO"

require "./src/micrate"

ENV["DATABASE_URL"] = "BAR"

pp Micrate::DB.connection_url # => "FOO"

After:

ENV["DATABASE_URL"] = "FOO"

require "./src/micrate"

ENV["DATABASE_URL"] = "BAR"

pp Micrate::DB.connection_url # => "BAR"

@hugopl
Copy link
Contributor

hugopl commented Jan 18, 2024

I'm not a contributor (yet) but these changes looks good to me.

@crimson-knight crimson-knight merged commit b8355cf into amberframework:master Jan 30, 2024
@Blacksmoke16 Blacksmoke16 deleted the lazy-db-url branch January 30, 2024 17:09
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.

None yet

3 participants