Skip to content

Commit

Permalink
Merge pull request #54 from lauhon/patch-1
Browse files Browse the repository at this point in the history
feat: allow db cert specification
  • Loading branch information
brunojppb authored Dec 3, 2024
2 parents 55022fa + 56a77d7 commit bcbea5a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
13 changes: 13 additions & 0 deletions config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,21 @@ if config_env() == :prod do
maybe_ipv6 = if System.get_env("ECTO_IPV6"), do: [:inet6], else: []
use_db_ssl = System.get_env("USE_DB_SSL") == "1"

db_ssl_opts =
if System.get_env("DATABASE_CA_CERT") do
[
verify: :verify_peer,
cacertfile: System.get_env("DATABASE_CA_CERT"),
verify_fun: &:ssl_verify_hostname.verify_fun/3,
server_name_indication: String.to_charlist(System.get_env("DATABASE_HOST", ""))
]
else
[]
end

config :turbo, Turbo.Repo,
ssl: use_db_ssl,
ssl_opts: db_ssl_opts,
url: database_url,
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10"),
socket_options: maybe_ipv6
Expand Down
1 change: 0 additions & 1 deletion docker-compose.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ services:
- "4000:4000"
volumes:
- ./docker_turbo_artifacts:/var/turbo_artifacts

turbo_racer_db:
image: postgres:14.2
container_name: turbo_racer_db
Expand Down

0 comments on commit bcbea5a

Please sign in to comment.