Split from btcprice monolith. Owns DB, migrations, Binance WebSocket, Kraken OHLC pollers, and exposes a JSON API with SSE price stream. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
60 lines
1.6 KiB
Clojure
60 lines
1.6 KiB
Clojure
{:system/env #profile {:dev :dev :test :test :prod :prod}
|
|
|
|
:server/http
|
|
{:port #long #or [#env BTCDATA_PORT 4100]
|
|
:host #or [#env HTTP_HOST "0.0.0.0"]
|
|
:handler #ig/ref :handler/ring}
|
|
|
|
:handler/ring
|
|
{:router #ig/ref :router/core
|
|
:api-path "/api"
|
|
:cors-origin #or [#env CORS_ORIGIN "*"]
|
|
:site-defaults-config
|
|
{:params {:keywordize true
|
|
:multipart true
|
|
:nested true}
|
|
:cookies false
|
|
:session false
|
|
:security {:anti-forgery false
|
|
:xss-protection {:enable? true :mode :block}
|
|
:frame-options :sameorigin}
|
|
:responses {:not-modified-responses true
|
|
:absolute-redirects true
|
|
:content-types true
|
|
:default-charset "utf-8"}}}
|
|
|
|
:router/routes
|
|
{:routes #ig/refset :reitit/routes}
|
|
|
|
:router/core
|
|
{:routes #ig/ref :router/routes
|
|
:env #ig/ref :system/env}
|
|
|
|
:db.sql/connection
|
|
{:jdbc-url #env JDBC_URL}
|
|
|
|
:db.sql/query-fn
|
|
{:conn #ig/ref :db.sql/connection
|
|
:options {}
|
|
:filename "queries.sql"}
|
|
|
|
:db.sql/migrations
|
|
{:store :database
|
|
:db {:datasource #ig/ref :db.sql/connection}
|
|
:migrate-on-init? true}
|
|
|
|
:reitit.routes/api
|
|
{:base-path "/api"
|
|
:query-fn #ig/ref :db.sql/query-fn
|
|
:binance #ig/ref :ws/binance}
|
|
|
|
:ws/binance
|
|
{:query-fn #ig/ref :db.sql/query-fn
|
|
:uri "wss://stream.binance.com:9443/ws/btcusdt@trade"}
|
|
|
|
:kraken/ohlc
|
|
{:query-fn #ig/ref :db.sql/query-fn}
|
|
|
|
:kraken/ohlc-day
|
|
{:query-fn #ig/ref :db.sql/query-fn}}
|