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:
@@ -1,3 +1,6 @@
|
||||
include .env
|
||||
export
|
||||
|
||||
.PHONY: clean run repl tailwind test uberjar
|
||||
|
||||
clean:
|
||||
|
||||
@@ -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"}
|
||||
|
||||
Vendored
+5
-3
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 []))))
|
||||
|
||||
Reference in New Issue
Block a user