From 5c5834e497cbe90cde7b4d34aab27b7a7921a2d7 Mon Sep 17 00:00:00 2001 From: Per Magnus Petersen Date: Tue, 17 Feb 2026 15:03:41 +0100 Subject: [PATCH] Use .env for database config, upgrade integrant/repl to 0.5.0 Load .env vars via Makefile, use #env JDBC_URL for all profiles in system.edn, switch ig/prep to ig/expand, and add missing namespace requires in core.clj to match elprice project conventions. Co-Authored-By: Claude Opus 4.6 --- Makefile | 3 +++ deps.edn | 2 +- env/dev/clj/user.clj | 8 +++++--- resources/system.edn | 4 ++-- src/clj/pmagnus/btcprice/core.clj | 8 ++++++-- 5 files changed, 17 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 33e0bf2..15543fa 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,6 @@ +include .env +export + .PHONY: clean run repl tailwind test uberjar clean: diff --git a/deps.edn b/deps.edn index e623494..85fde67 100644 --- a/deps.edn +++ b/deps.edn @@ -39,7 +39,7 @@ :ns-default build} :dev {:extra-paths ["env/dev/clj" "env/dev/resources" "test/clj"] - :extra-deps {integrant/repl {:mvn/version "0.4.0"} + :extra-deps {integrant/repl {:mvn/version "0.5.0"} criterium/criterium {:mvn/version "0.4.6"} expound/expound {:mvn/version "0.9.0"} com.lambdaisland/classpath {:mvn/version "0.4.44"} diff --git a/env/dev/clj/user.clj b/env/dev/clj/user.clj index 7a08cb2..41e4600 100644 --- a/env/dev/clj/user.clj +++ b/env/dev/clj/user.clj @@ -3,19 +3,21 @@ [clojure.tools.logging :as log] [integrant.core :as ig] [integrant.repl :refer [go halt reset reset-all set-prep!]] - [pmagnus.btcprice.config :as config])) + [integrant.repl.state :as state] + [pmagnus.btcprice.config :as config] + [pmagnus.btcprice.core])) (defn dev-prep! [] (set-prep! (fn [] (-> (config/system-config {:profile :dev}) - (ig/prep))))) + (ig/expand))))) (defn test-prep! [] (set-prep! (fn [] (-> (config/system-config {:profile :test}) - (ig/prep))))) + (ig/expand))))) (defn reset-db [] (let [sys (or @pmagnus.btcprice.core/system diff --git a/resources/system.edn b/resources/system.edn index dfd5000..4d00494 100644 --- a/resources/system.edn +++ b/resources/system.edn @@ -33,8 +33,8 @@ :env #ig/ref :system/env} :db.sql/connection - #profile {:dev {:jdbc-url "jdbc:postgresql://localhost:5432/btcprice?user=btcprice&password=btcprice"} - :test {:jdbc-url "jdbc:postgresql://localhost:5432/btcprice?user=btcprice&password=btcprice"} + #profile {:dev {:jdbc-url #env JDBC_URL} + :test {:jdbc-url #env JDBC_URL} :prod {:jdbc-url #env JDBC_URL :init-size 1 :min-idle 1 diff --git a/src/clj/pmagnus/btcprice/core.clj b/src/clj/pmagnus/btcprice/core.clj index 6c8c7a5..c184c8b 100644 --- a/src/clj/pmagnus/btcprice/core.clj +++ b/src/clj/pmagnus/btcprice/core.clj @@ -9,7 +9,11 @@ [kit.edge.db.postgres] [kit.edge.db.sql.conman] [kit.edge.db.sql.migratus] - [kit.edge.server.undertow]) + [kit.edge.server.undertow] + [pmagnus.btcprice.web.handler] + ;; Routes + [pmagnus.btcprice.web.routes.api] + [pmagnus.btcprice.web.routes.ui]) (:gen-class)) (defonce system (atom nil)) @@ -22,7 +26,7 @@ (defn start-app [& [params]] ((or (:init defaults) (fn []))) (->> (config/system-config (or params {})) - (ig/prep) + (ig/expand) (ig/init) (reset! system)) ((or (:start defaults) (fn []))))