Tackling bit-rot

This commit is contained in:
Simon Brooke 2021-12-09 20:12:59 +00:00
parent b07f69fb51
commit 741c857a7a
No known key found for this signature in database
GPG key ID: A7A4F18D1D4DF987
10 changed files with 54 additions and 46 deletions

View file

@ -8,7 +8,7 @@
[noir.util.middleware :refer [app-handler]]
[compojure.route :as route]
[taoensso.timbre :as timbre]
[taoensso.timbre.appenders.rotor :as rotor]
;; [taoensso.timbre.appenders.rotor :as rotor]
[selmer.parser :as parser]
[environ.core :refer [env]]))
@ -46,19 +46,19 @@
an app server such as Tomcat
put any initialization code here"
[]
(timbre/set-config!
[:appenders :rotor]
{:min-level :info
:enabled? true
:async? false ; should be always false for rotor
:max-message-per-msecs nil
:fn rotor/appender-fn})
(timbre/set-config!
[:shared-appender-config :rotor]
{:path "mw_ui.log" :max-size (* 512 1024) :backlog 10})
;; (timbre/set-config!
;; [:appenders :rotor]
;; {:min-level :info
;; :enabled? true
;; :async? false ; should be always false for rotor
;; :max-message-per-msecs nil
;; :fn rotor/appender-fn})
;; (timbre/set-config!
;; [:shared-appender-config :rotor]
;; {:path "mw_ui.log" :max-size (* 512 1024) :backlog 10})
(if (env :dev) (parser/cache-off!))
(when (env :dev) (parser/cache-off!))
(timbre/info "mw-ui started successfully"))

View file

@ -1,12 +1,11 @@
(ns ^{:doc "In truth, boilerplate from Luminus."
:author "Simon Brooke"}
mw-ui.middleware
mw-ui.middleware
(:require [taoensso.timbre :as timbre]
[selmer.parser :as parser]
[environ.core :refer [env]]
[selmer.middleware :refer [wrap-error-page]]
[noir-exception.core
:refer [wrap-internal-error wrap-exceptions]]))
:refer [wrap-internal-error wrap-exceptions]]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;

View file

@ -1,9 +1,10 @@
(ns ^{:doc "In truth, boilerplate from Luminus."
:author "Simon Brooke"}
mw-ui.repl
(:use mw-ui.handler
ring.server.standalone
[ring.middleware file-info file])
(:require [mw-ui.handler :as handler]
[ring.server.standalone :refer [serve]]
[ring.middleware.file :refer [wrap-file]]
[ring.middleware.file-info :refer [wrap-file-info]])
(:gen-class))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -37,7 +38,7 @@
;; the server is forced to re-resolve the symbol in the var
;; rather than having its own copy. When the root binding
;; changes, the server picks it up without having to restart.
(-> #'app
(-> #'handler/app
; Makes static assets in $PROJECT_DIR/resources/public/ available.
(wrap-file "resources")
; Content-Type, Content-Length, and Last Modified headers for files in body
@ -50,9 +51,9 @@
(reset! server
(serve (get-handler)
{:port port
:init init
:init handler/init
:auto-reload? true
:destroy destroy
:destroy handler/destroy
:join? false}))
(println (str "You can view the site at http://localhost:" port))))
@ -62,3 +63,4 @@
(defn -main []
(start-server))