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 <noreply@anthropic.com>
This commit is contained in:
2026-02-17 15:03:41 +01:00
co-authored by Claude Opus 4.6
parent f7b571f670
commit 5c5834e497
5 changed files with 17 additions and 8 deletions
+3
View File
@@ -1,3 +1,6 @@
include .env
export
.PHONY: clean run repl tailwind test uberjar
clean:
+1 -1
View File
@@ -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"}
+5 -3
View File
@@ -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
+2 -2
View File
@@ -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
+6 -2
View File
@@ -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 []))))