This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-05-05
Channels
- # announcements (8)
- # babashka (6)
- # beginners (55)
- # biff (8)
- # calva (11)
- # cider (4)
- # clj-kondo (6)
- # cljdoc (23)
- # cljs-dev (22)
- # clojure (89)
- # clojure-brasil (3)
- # clojure-europe (47)
- # clojure-indonesia (1)
- # clojure-nl (1)
- # clojure-spec (3)
- # clojure-uk (5)
- # clojurescript (67)
- # community-development (2)
- # conjure (29)
- # cursive (2)
- # datalog (29)
- # datomic (41)
- # defnpodcast (4)
- # emacs (15)
- # google-cloud (5)
- # holy-lambda (6)
- # hyperfiddle (3)
- # introduce-yourself (8)
- # jobs (1)
- # malli (19)
- # meander (41)
- # nrepl (1)
- # off-topic (30)
- # pathom (22)
- # polylith (30)
- # releases (1)
- # remote-jobs (4)
- # sci (4)
- # shadow-cljs (1)
- # spacemacs (7)
- # specter (3)
- # tools-build (16)
- # tools-deps (2)
Hello. I'm working with a Clojure app that uses https://github.com/weavejester/integrant. We'd like to deploy it with Holy-Lambda but, based on the examples, it seems that Holy-Lambda expects a handler function? Is it possible to use Integrant/Mount system libraries when deploying with Holy Lambda?
A quick answer. Yes.
I'll write a longer answer in 2 hours. Just getting up from the :sleeping_accommodation:.
;; EXAMPLE 1 - routes outside of the system
(defn AWSLambdaHandler [system request] {:body "Hello" :statusCode 200 :headers {})
(def system (atom nil))
(defn wrap-with-system [handler]
(fn [request]
(handler @system request)))
(defn start-system
[]
(reset! system (sys/start-system {:profile :prod
:base :lambda})))
(def AWSLambdaHandlerWrapped (wrap-with-system AWSLambdaHandler)
(h/entrypoint [#'AWSLambdaHandlerWrapped] {:init-hook start-system})
;; Example 2 - routes inside a system
(defn AWSLambdaHandler [system request] {:body "Hello" :statusCode 200 :headers {})
(defn match-handler-by-request [request] AWSLambdaHandler)
(def system (atom nil))
(defn wrap-with-system []
(fn [request]
((match-handler-by-request @system request) @system request)))
(defn start-system
[]
(reset! system (sys/start-system {:profile :prod
:base :lambda})))
(def UnifiedAWSLambdaWrapper (wrap-with-system))
(h/entrypoint [#'UnifiedAWSLambdaWrapper] {:init-hook start-system})
Amazing! I will try this. Thank you!
You are very welcome! Thank you for asking this question.