Skip to content

Commit bec8cd5

Browse files
authored
chore: update ssl config (#161)
1 parent d43a06a commit bec8cd5

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

config/runtime.exs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,25 +54,20 @@ if config_env() == :prod do
5454

5555
maybe_ipv6 = if System.get_env("ECTO_IPV6"), do: [:inet6], else: []
5656

57+
ssl_config =
58+
if System.get_env("DATABASE_SSL", "true") == "true",
59+
do: [cacerts: :public_key.cacerts_get()],
60+
else: nil
61+
5762
config :wordcharts, Wordcharts.Repo,
5863
database: System.get_env("DATABASE_NAME"),
5964
hostname: System.get_env("DATABASE_HOST"),
6065
password: System.get_env("DATABASE_USER_PASSWORD"),
6166
username: System.get_env("DATABASE_USER"),
6267
pool_size: String.to_integer(System.get_env("POOL_SIZE", "10")),
6368
port: String.to_integer(System.get_env("DATABASE_PORT", "5432")),
64-
ssl: System.get_env("DATABASE_SSL", "true") == "true",
65-
socket_options: maybe_ipv6,
66-
ssl_opts: [
67-
verify: :verify_peer,
68-
cacerts: :public_key.cacerts_get(),
69-
versions: [:"tlsv1.3"],
70-
depth: 3,
71-
server_name_indication: String.to_charlist(System.get_env("DATABASE_HOST")),
72-
customize_hostname_check: [
73-
match_fun: :public_key.pkix_verify_hostname_match_fun(:https)
74-
]
75-
]
69+
ssl: ssl_config,
70+
socket_options: maybe_ipv6
7671

7772
# The secret key base is used to sign/encrypt cookies and other secrets.
7873
# A default value is used in config/dev.exs and config/test.exs but you

mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ defmodule Wordcharts.MixProject do
44
def project do
55
[
66
app: :wordcharts,
7-
version: "0.1.9",
7+
version: "0.1.10",
88
elixir: "~> 1.12",
99
elixirc_paths: elixirc_paths(Mix.env()),
1010
start_permanent: Mix.env() == :prod,

0 commit comments

Comments
 (0)