Skip to content

Commit

Permalink
Merge pull request #15 from Actuarial-Sciences-for-Africa-ASA/master
Browse files Browse the repository at this point in the history
fix issue #14
  • Loading branch information
essenciary authored Aug 11, 2022
2 parents c810b25 + a64ac8c commit 7ba8c79
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/SearchLightPostgreSQL.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,14 @@ Connects to the database and returns a handle.
function SearchLight.connect(conn_data::Dict = SearchLight.config.db_config_settings) :: DatabaseHandle
dns = String[]

for key in ["host", "hostaddr", "port", "database", "username", "password", "passfile", "connect_timeout", "client_encoding"]
for key in ["host", "hostaddr", "port", "password", "passfile", "connect_timeout", "client_encoding"]
get!(conn_data, key, get(ENV, "SEARCHLIGHT_$(uppercase(key))", nothing))
conn_data[key] !== nothing && push!(dns, string("$key=", conn_data[key]))
end


haskey(conn_data, "database") && push!(dns, string("dbname=", conn_data["database"]))
haskey(conn_data, "username") && push!(dns, string("user=", conn_data["username"]))

push!(CONNECTIONS, LibPQ.Connection(join(dns, " ")))[end]
end

Expand Down

0 comments on commit 7ba8c79

Please sign in to comment.