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

Render a proper connection string without username or password #445

Merged
merged 2 commits into from
Mar 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions spec/adapter/base_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,15 @@ describe Jennifer::Adapter::Base do
adapter.connection_string(:root).should match(connection_string)
end
end

context "without username or password" do
it do
config.user = ""
config.password = ""
connection_string = /^#{adapter.class.protocol}\:\/\/#{config.host}/
adapter.connection_string(:root).should match(connection_string)
end
end
end

describe "#query_array" do
Expand Down
2 changes: 1 addition & 1 deletion src/jennifer/adapter/base.cr
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ module Jennifer
config.port.try(&.>(0)) ? config.port : nil,
type.db? ? config.db : "",
connection_query,
config.user,
config.user.blank? ? nil : config.user,
config.password && !config.password.empty? ? config.password : nil
).to_s
end
Expand Down
Loading