Created
January 17, 2020 10:28
-
-
Save choestelus/d94be5138441b4ffbf172101fefd503e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule PingPgTls.DBConnection do | |
def test_connect do | |
opts = [ | |
hostname: "localhost", | |
port: 5432, | |
username: "postgres", | |
password: "postgres", | |
database: "postgres", | |
ssl: true, | |
ssl_opts: [ | |
cacertfile: "cert/pg_ca.crt", | |
keyfile: "cert/pg_client.key", | |
certfile: "cert/pg_client.crt", | |
verify: :verify_peer, | |
version: [:"tlsv1.2", :"tlsv1.3"], | |
server_name_indication: :disable, | |
fallback: false | |
] | |
] | |
{:ok, pid} = Postgrex.start_link(opts) | |
IO.inspect(pid) | |
Postgrex.query!(pid, ~s(SELECT 1+1), []) |> IO.inspect() | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment