Skip to content

Commit 63f0f46

Browse files
committed
Removing unused key
1 parent 7a3f0ff commit 63f0f46

5 files changed

+2
-6
lines changed

config.namespaced-example.edn

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
:triangulum.handler/private-response-keys #{}
2424
:triangulum.handler/upload-max-size-mb 100
2525
:triangulum.handler/upload-max-file-count 10
26-
:triangulum.handler/cors? false
2726
:triangulum.handler/cors-headers {"Access-Control-Allow-Origin" "https://example.com"
2827
"Access-Control-Allow-Methods" "GET, POST, PUT, DELETE"
2928
"Access-Control-Allow-Headers" "Content-Type, Authorization"

config.nested-example.edn

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
:stop product-ns.jobs/stop-scheduled-jobs!}}
3030

3131
;; cors
32-
:cors? false
3332
:cors-headers {"Access-Control-Allow-Origin" "https://example.com"
3433
"Access-Control-Allow-Methods" "GET, POST, PUT, DELETE"
3534
"Access-Control-Allow-Headers" "Content-Type, Authorization"

src/triangulum/config_namespaced_spec.clj

-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
:triangulum.handler/upload-max-size-mb
4141
:triangulum.handler/upload-max-file-count
4242
:triangulum.handler/cors-headers
43-
:triangulum.handler/cors?
4443
:triangulum.worker/workers
4544
:triangulum.response/response-type])))
4645

src/triangulum/config_nested_spec.clj

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
:triangulum.handler/upload-max-size-mb
2727
:triangulum.handler/upload-max-file-count
2828
:triangulum.handler/cors-headers
29-
:triangulum.handler/cors?
3029
:triangulum.worker/workers
3130
:triangulum.response/response-type]))
3231

src/triangulum/handler.clj

+2-2
Original file line numberDiff line numberDiff line change
@@ -186,14 +186,14 @@
186186
"Adds CORS headers for specific routes"
187187
[handler]
188188
(fn [{:keys [uri headers] :as request}]
189-
(let [cors-config (get-config :handler :cors)
189+
(let [cors-config (get-config :handler :cors-headers)
190190
routes (->> (get-config :triangulum.handler/routing-tables)
191191
(map (comp deref resolve-foreign-symbol))
192192
(apply merge))
193193
route (some (fn [[key value]]
194194
(when (= (second key) uri)
195195
{key value})) routes)]
196-
(if (get-in route [1 :cors?])
196+
(if (get-in route [1 :cors])
197197
(handler (assoc request :headers (merge headers cors-config)))
198198
(handler request)))))
199199

0 commit comments

Comments
 (0)