-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update postgrex config * enable ssl only if DATABASE_CACERTFILE is set * update tests * changelog --------- Co-authored-by: Cenk Kücük <[email protected]>
- Loading branch information
1 parent
e9dd895
commit 19ecd3d
Showing
3 changed files
with
25 additions
and
24 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -359,14 +359,7 @@ defmodule Plausible.ConfigTest do | |
|
||
assert get_in(config, [:plausible, Plausible.Repo]) == [ | ||
url: "postgres://postgres:postgres@plausible_db:5432/plausible_db", | ||
socket_options: [], | ||
ssl_opts: [ | ||
cacertfile: CAStore.file_path(), | ||
verify: :verify_peer, | ||
customize_hostname_check: [ | ||
match_fun: :public_key.pkix_verify_hostname_match_fun(:https) | ||
] | ||
] | ||
socket_options: [] | ||
] | ||
end | ||
|
||
|
@@ -405,17 +398,27 @@ defmodule Plausible.ConfigTest do | |
|
||
config = runtime_config(env) | ||
|
||
assert get_in(config, [:plausible, Plausible.Repo]) == [ | ||
url: | ||
"postgresql://your_username:[email protected]:25060/defaultdb", | ||
socket_options: [] | ||
] | ||
end | ||
|
||
test "DATABASE_CACERTFILE enables SSL" do | ||
env = [ | ||
{"DATABASE_URL", | ||
"postgresql://your_username:[email protected]:25060/defaultdb"}, | ||
{"DATABASE_CACERTFILE", "/path/to/cacert.pem"} | ||
] | ||
|
||
config = runtime_config(env) | ||
|
||
assert get_in(config, [:plausible, Plausible.Repo]) == [ | ||
url: | ||
"postgresql://your_username:[email protected]:25060/defaultdb", | ||
socket_options: [], | ||
ssl_opts: [ | ||
cacertfile: CAStore.file_path(), | ||
verify: :verify_peer, | ||
customize_hostname_check: [ | ||
match_fun: :public_key.pkix_verify_hostname_match_fun(:https) | ||
] | ||
] | ||
ssl: [cacertfile: "/path/to/cacert.pem"] | ||
] | ||
end | ||
end | ||
|