noahsettersten commited on
Commit
f22b0a2
1 Parent(s): 283051d

chore: Configure for connecting to Neon's Postgres

Browse files
config/runtime.exs CHANGED
@@ -30,13 +30,22 @@ if config_env() == :prod do
30
  # For example: ecto://USER:PASS@HOST/DATABASE
31
  # """
32
 
33
- maybe_ipv6 = if System.get_env("ECTO_IPV6") in ~w(true 1), do: [:inet6], else: []
34
 
 
35
  config :medical_transcription, MedicalTranscription.Repo,
36
- # ssl: true,
37
  url: database_url,
38
  pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10"),
39
- socket_options: maybe_ipv6
 
 
 
 
 
 
 
 
40
 
41
  # The secret key base is used to sign/encrypt cookies and other secrets.
42
  # A default value is used in config/dev.exs and config/test.exs but you
 
30
  # For example: ecto://USER:PASS@HOST/DATABASE
31
  # """
32
 
33
+ # maybe_ipv6 = if System.get_env("ECTO_IPV6") in ~w(true 1), do: [:inet6], else: []
34
 
35
+ # Previously, this has `socket_options: maybe_ipv6`, but removing that appeared to help connect to the DB.
36
  config :medical_transcription, MedicalTranscription.Repo,
37
+ ssl: true,
38
  url: database_url,
39
  pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10"),
40
+ socket_options: [],
41
+ ssl_opts: [
42
+ cacertfile: "/etc/ssl/certs/ca-certificates.crt",
43
+ verify: :verify_peer,
44
+ server_name_indication: to_charlist(System.get_env("DATABASE_HOST")),
45
+ customize_hostname_check: [
46
+ match_fun: :public_key.pkix_verify_hostname_match_fun(:https)
47
+ ]
48
+ ]
49
 
50
  # The secret key base is used to sign/encrypt cookies and other secrets.
51
  # A default value is used in config/dev.exs and config/test.exs but you
lib/medical_transcription/application.ex CHANGED
@@ -17,8 +17,7 @@ defmodule MedicalTranscription.Application do
17
 
18
  children = [
19
  MedicalTranscriptionWeb.Telemetry,
20
- # TODO: Re-enable this when we have a database set up for the Fly app.
21
- # MedicalTranscription.Repo,
22
  # TODO: We may need to manually disable this when testing locally in Docker
23
  {DNSCluster,
24
  query: Application.get_env(:medical_transcription, :dns_cluster_query) || :ignore},
 
17
 
18
  children = [
19
  MedicalTranscriptionWeb.Telemetry,
20
+ MedicalTranscription.Repo,
 
21
  # TODO: We may need to manually disable this when testing locally in Docker
22
  {DNSCluster,
23
  query: Application.get_env(:medical_transcription, :dns_cluster_query) || :ignore},