|
47 | 47 | "
|
48 | 48 | {:added "0.0.1"}
|
49 | 49 | [lambdas & [{:keys [init-hook disable-analytics?]
|
50 |
| - :or {init-hook (fn [] nil) |
51 |
| - disable-analytics? false}}]] |
| 50 | + :or {init-hook (fn [] nil) |
| 51 | + disable-analytics? false}}]] |
52 | 52 | `(do
|
53 | 53 | (def ~'PRVL_ROUTES (into {} (mapv (fn [l#] [(str (str (:ns (meta l#)) "." (str (:name (meta l#))))) l#]) ~lambdas)))
|
54 | 54 | (defn ~'-main [& attrs#]
|
| 55 | + (let [runtime-api-url# (System/getenv "AWS_LAMBDA_RUNTIME_API") |
| 56 | + handler-name# (or (first attrs#) (System/getenv "_HANDLER"))] |
55 | 57 |
|
56 |
| - ;; Side effect init-hook |
57 |
| - (~init-hook) |
| 58 | + ;; Side effect init-hook |
| 59 | + (~init-hook) |
58 | 60 |
|
59 |
| - ;; executor = native-agent -- Indicates that the configuration for compiling via `native-image` |
60 |
| - ;; will be generated via the agent. |
61 |
| - ;; |
62 |
| - ;; executor = anything else -- Run provided runtime loop |
63 |
| - (if (= (System/getProperty "executor") @#'fierycod.holy-lambda.agent/AGENT_EXECUTOR) |
64 |
| - ;; Generate the native configuration for the lambdas |
65 |
| - (#'fierycod.holy-lambda.agent/routes->reflective-call! ~'PRVL_ROUTES) |
| 61 | + ;; executor = native-agent -- Indicates that the configuration for compiling via `native-image` |
| 62 | + ;; will be generated via the agent. |
| 63 | + ;; |
| 64 | + ;; executor = anything else -- Run provided runtime loop |
| 65 | + (if (= (System/getProperty "executor") @#'fierycod.holy-lambda.agent/AGENT_EXECUTOR) |
| 66 | + ;; Generate the native configuration for the lambdas |
| 67 | + (#'fierycod.holy-lambda.agent/routes->reflective-call! ~'PRVL_ROUTES) |
66 | 68 |
|
67 |
| - ;; Start custom runtime loop |
68 |
| - (while true |
69 |
| - (#'fierycod.holy-lambda.custom-runtime/next-iter |
70 |
| - (System/getenv "AWS_LAMBDA_RUNTIME_API") |
71 |
| - (or (first attrs#) (System/getenv "_HANDLER")) |
72 |
| - ~'PRVL_ROUTES |
73 |
| - ~disable-analytics?)))))) |
| 69 | + ;; Start custom runtime loop |
| 70 | + (while true |
| 71 | + (#'fierycod.holy-lambda.custom-runtime/next-iter |
| 72 | + runtime-api-url# |
| 73 | + handler-name# |
| 74 | + ~'PRVL_ROUTES |
| 75 | + ~disable-analytics?))))))) |
0 commit comments