Skip to content

fix: do not attempt db connection if jsonc section is missing #375

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

Merged
merged 14 commits into from
Apr 25, 2025

Conversation

juleswritescode
Copy link
Collaborator

@juleswritescode juleswritescode commented Apr 25, 2025

If the user did not specify the db section in the jsonc, we would per default try to connect to postgresql://postgres:[email protected]:5432/postgres.

The reason is the biome_serialize_macros::Merge macro:

If two configuration.dbs are None, they are merged into a Some(PartialConfiguration {}) where all properties are None; if we then call DatabaseSettings::from(partial_configuration), the partial config is merged with DatabaseSettings::default() – where we specified the above connection settings.

We can't really work around that without refactoring the whole configuration shenaigans, so I pulled the cli_options.skip_db flag into the database settings.

You can still pass it as postgrestools check --disable-db test.sql, and it is hidden in the .jsonc.

When a user does not specify a db.host in the jsonc, all db-connections are now disabled.

@@ -179,21 +179,36 @@ export interface GetCompletionsParams {
*/
position: TextSize;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

auto-generated

@juleswritescode juleswritescode merged commit 2820bb5 into main Apr 25, 2025
7 checks passed
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.

2 participants