<commit_before>(ns clj.medusa.core
  (:require [org.httpkit.server :as http]
            [liberator.dev :refer [wrap-trace]]
            [compojure.core :refer :all]
            [compojure.route :as route]
            [compojure.handler :as handler]
            [clj.medusa.config :as config]
            [clj.medusa.db :as db]
            [clj.medusa.resource :as resource]
            [clj.medusa.persona :as persona]
            [ring.middleware.reload :as reload]
            [ring.util.response :as response]
            [cemerick.friend :as friend]
            (cemerick.friend [workflows :as workflows]
                             [credentials :as creds])))

(defroutes app
  (GET "/" [] (response/redirect "index.html"))
  (GET "/status" [] "ok")
  (ANY "/login" []
       (resource/login))
  (ANY "/logout" []
       (friend/logout (resource/logout)))
  (ANY "/subscriptions" [& params]
       (resource/subscriptions params))
  (ANY "/detectors/" [& params]
       (resource/detectors-resource params))
  (ANY "/detectors/:id" [& params]
       (resource/detector-resource params))
  (ANY "/detectors/:detector_id/metrics/" [& params]
       (resource/metrics-resource params))
  (ANY "/detectors/:detector_id/metrics/:metric_id" [& params]
       (resource/metrics-resource params))
  (ANY "/detectors/:detector_id/metrics/:metric_id/alerts/" [& params]
       (resource/alerts-resource params))
  (ANY "/detectors/:detector_id/metrics/:metric_id/alerts/:id" [& params]
       (resource/alerts-resource params))
  (ANY "/detectors/:detector_id/alerts/" [& params]
       (resource/alerts-resource params))
  (route/resources "/")
  (route/not-found "Page not found"))

(def handler
  (-> app
      (wrap-trace :header :ui)
      (friend/authenticate {:credential-fn persona/credential-fn
                            :workflows [(partial persona/workflow "/login")]})))

(config/initialize)
(db/initialize)

(defn -main []
  (http/run-server (reload/wrap-reload (handler/site #'handler)) {:port (:port @config/state)}))<commit_msg>Disable liberator debugging decorator.<commit_after>(ns clj.medusa.core
  (:require [org.httpkit.server :as http]
            [liberator.dev :refer [wrap-trace]]
            [compojure.core :refer :all]
            [compojure.route :as route]
            [compojure.handler :as handler]
            [clj.medusa.config :as config]
            [clj.medusa.db :as db]
            [clj.medusa.resource :as resource]
            [clj.medusa.persona :as persona]
            [ring.middleware.reload :as reload]
            [ring.util.response :as response]
            [cemerick.friend :as friend]
            (cemerick.friend [workflows :as workflows]
                             [credentials :as creds])))

(defroutes app
  (GET "/" [] (response/redirect "index.html"))
  (GET "/status" [] "ok")
  (ANY "/login" []
       (resource/login))
  (ANY "/logout" []
       (friend/logout (resource/logout)))
  (ANY "/subscriptions" [& params]
       (resource/subscriptions params))
  (ANY "/detectors/" [& params]
       (resource/detectors-resource params))
  (ANY "/detectors/:id" [& params]
       (resource/detector-resource params))
  (ANY "/detectors/:detector_id/metrics/" [& params]
       (resource/metrics-resource params))
  (ANY "/detectors/:detector_id/metrics/:metric_id" [& params]
       (resource/metrics-resource params))
  (ANY "/detectors/:detector_id/metrics/:metric_id/alerts/" [& params]
       (resource/alerts-resource params))
  (ANY "/detectors/:detector_id/metrics/:metric_id/alerts/:id" [& params]
       (resource/alerts-resource params))
  (ANY "/detectors/:detector_id/alerts/" [& params]
       (resource/alerts-resource params))
  (route/resources "/")
  (route/not-found "Page not found"))

(def handler
  (-> app
      #_(wrap-trace :header :ui)
      (friend/authenticate {:credential-fn persona/credential-fn
                            :workflows [(partial persona/workflow "/login")]})))

(config/initialize)
(db/initialize)

(defn -main []
  (http/run-server (reload/wrap-reload (handler/site #'handler)) {:port (:port @config/state)}))
{'fraction_non_alphanumeric': 0.15811238141571393, 'fraction_numerical': 0.0, 'mean_word_length': 2.6357206012378427, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7185742', 'n_tokens_mistral': 1322, 'n_tokens_neox': 1324, 'n_words': 262}