Use :uri instead of :host/:port as :spec for carmine

clj-a2png
Marcin Kulik 7 years ago
parent 70fd5608f6
commit a3feeb6454

@ -25,8 +25,7 @@
:bucket s3-bucket
:path-prefix "uploads/"}
:exp-set
{:host redis-host
:port redis-port}
{:uri redis-url}
:png-gen
{:bin-path a2png-bin-path}
:executor

@ -5,12 +5,12 @@
[com.stuartsierra.component :as component]
[taoensso.carmine :as car]))
(defrecord RedisClient [host port]
(defrecord RedisClient [uri]
component/Lifecycle
(start [component]
(if (:listener component)
component
(let [conn {:pool {} :spec {:host host :port port}}]
(let [conn {:pool {} :spec {:uri uri}}]
(assoc component :conn conn))))
(stop [component]
(if (:conn component)
@ -24,5 +24,5 @@
(contains? [this value]
(car/as-bool (car/wcar (:conn this) (car/exists value)))))
(defn redis-client [{:keys [host port]}]
(->RedisClient host port))
(defn redis-client [{:keys [uri]}]
(->RedisClient uri))

@ -32,8 +32,7 @@
's3-bucket (:s3-bucket env)
's3-access-key (:s3-access-key env)
's3-secret-key (:s3-secret-key env)
'redis-host (:redis-host env "localhost")
'redis-port (Integer/parseInt (:redis-port env "6379"))
'redis-url (:redis-url env "redis://localhost")
'a2png-bin-path (:a2png-bin-path env "a2png/a2png.sh")}
system (->> (load-system [(io/resource "asciinema/system.edn")] bindings)
(component/start))]

Loading…
Cancel
Save