Skip to content

Commit

Permalink
Merge pull request #16 from brunojppb/database-ssl-option
Browse files Browse the repository at this point in the history
Add option to enable database SSL connection
  • Loading branch information
brunojppb authored Aug 23, 2022
2 parents be65781 + f20d9ae commit df20f80
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .do/deploy.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ spec:
- key: DATABASE_URL
scope: RUN_TIME
value: ${turbo-db.DATABASE_URL}
- key: USE_DB_SSL
scope: RUN_TIME
value: "1"
databases:
- name: turbo-db
engine: PG
3 changes: 2 additions & 1 deletion config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@ 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"

config :turbo, Turbo.Repo,
# ssl: true,
ssl: use_db_ssl,
url: database_url,
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10"),
socket_options: maybe_ipv6
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ services:
environment:
# Postgres database URL pattern expected by Ecto: postgres://USER:PASS@HOST/DATABASE
- DATABASE_URL=postgres://turbo_racer:please_replace_me@turbo_racer_db/turbo_racer
# If you want to use SSL when connecting to your DB
# - USE_DB_SSL=1
- SECRET_KEY_BASE=please_replace_me_with_something_random_and_strong_at_least_64_characters_long
- PHX_HOST=localhost
- PORT=4000
Expand Down

0 comments on commit df20f80

Please sign in to comment.