summaryrefslogtreecommitdiff
path: root/lib/silmataivas/repo.ex
diff options
context:
space:
mode:
authorDawid Rycerz <dawid@rycerz.xyz>2025-03-23 17:11:39 +0100
committerDawid Rycerz <dawid@rycerz.xyz>2025-04-05 21:16:51 +0200
commit0ab2e5ba2b0631b28b5b1405559237b3913c878f (patch)
tree791cea788b0a62bc483d0041fbd0c655d2ad49e8 /lib/silmataivas/repo.ex
feat: initialize Phoenix application for weather alerts
This commit sets up the initial Silmataivas project structure, including: Phoenix web framework configuration, database models for users and locations, weather polling service, notification system, Docker and deployment configurations, CI/CD pipeline setup
Diffstat (limited to 'lib/silmataivas/repo.ex')
-rw-r--r--lib/silmataivas/repo.ex20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/silmataivas/repo.ex b/lib/silmataivas/repo.ex
new file mode 100644
index 0000000..d1bbcca
--- /dev/null
+++ b/lib/silmataivas/repo.ex
@@ -0,0 +1,20 @@
+defmodule Silmataivas.Repo do
+ use Ecto.Repo,
+ otp_app: :silmataivas,
+ adapter: Ecto.Adapters.SQLite3
+
+ @doc """
+ Dynamic adapter configuration based on application environment.
+
+ This will be automatically called by Ecto during startup.
+ """
+ def init(_type, config) do
+ # Check for adapter in config, fall back to Ecto.Adapters.SQLite3
+ adapter =
+ config[:adapter] ||
+ Application.get_env(:silmataivas, Silmataivas.Repo, [])[:adapter] ||
+ Ecto.Adapters.SQLite3
+
+ {:ok, Keyword.put(config, :adapter, adapter)}
+ end
+end