From 6ad7f7233d87aac4b1481d08bcfbc9535f2616fc Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Sat, 7 Mar 2026 15:45:42 -0600 Subject: [PATCH] fix: support DATABASE_URL in dev config for CI e2e tests --- config/dev.exs | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/config/dev.exs b/config/dev.exs index fcdf2ebc..086c61dd 100644 --- a/config/dev.exs +++ b/config/dev.exs @@ -126,14 +126,25 @@ config :towerops, Oban, ] # Configure your database -config :towerops, Towerops.Repo, - username: "postgres", - password: "postgres", - hostname: "localhost", - database: "towerops_dev", - stacktrace: true, - show_sensitive_data_on_connection_error: true, - pool_size: 10 +# Configure your database +# In CI, DATABASE_URL is set and will be used automatically by Ecto. +# Locally, fall back to individual connection parameters. +if database_url = System.get_env("DATABASE_URL") do + config :towerops, Towerops.Repo, + url: database_url, + stacktrace: true, + show_sensitive_data_on_connection_error: true, + pool_size: 10 +else + config :towerops, Towerops.Repo, + username: "postgres", + password: "postgres", + hostname: "localhost", + database: "towerops_dev", + stacktrace: true, + show_sensitive_data_on_connection_error: true, + pool_size: 10 +end # Configure Cloak encryption for development # Use a fixed key for development (DO NOT use in production!)