REPL now working; Tomcat per-instance configuration still not.

This commit is contained in:
Simon Brooke 2021-03-23 15:33:29 +00:00
parent f46af642a4
commit 9ca1cc05ab
No known key found for this signature in database
GPG key ID: A7A4F18D1D4DF987
3 changed files with 40 additions and 29 deletions

View file

@ -35,7 +35,10 @@
[prismatic/schema "1.1.9"] [prismatic/schema "1.1.9"]
[prone "1.1.4"] [prone "1.1.4"]
[ring/ring-anti-forgery "1.1.0"] [ring/ring-anti-forgery "1.1.0"]
[ring-server "0.4.0"] [ring/ring-core "1.9.1"]
[ring/ring-defaults "0.3.2"]
[ring-server "0.5.0"]
[ring-webjars "0.2.0"]
[selmer "1.11.0"]] [selmer "1.11.0"]]
:repl-options {:init-ns smeagol.repl} :repl-options {:init-ns smeagol.repl}

View file

@ -62,10 +62,11 @@
be used as for environment variables, because it just makes life easier." be used as for environment variables, because it just makes life easier."
[vars] [vars]
(log/info "Seeking config in initial context") (log/info "Seeking config in initial context")
(log/debug (str "Bound names are: " (map #(.toString %) (.list (new javax.naming.InitialContext) "java:comp/env/"))))
(try (try
(reduce (reduce
#(try #(try
(log/info "Seeking value for " %2 " in initial context") (log/debug "Seeking value for " %2 " in initial context")
(let [v (javax.naming.InitialContext/doLookup %2)] (let [v (javax.naming.InitialContext/doLookup %2)]
(if v (if v
(do (do
@ -73,10 +74,12 @@
(assoc %1 %2 v)) (assoc %1 %2 v))
%1)) %1))
(catch Exception e (catch Exception e
(log/warn (str "Error while seeking value for " %2 " in initial context: " (type e) "; " (.getMessage e))) (log/debug (str "Error while seeking value for " %2 " in initial context: " (type e) "; " (.getMessage e)))
%1)) %1))
{} {}
(map #(str "java:comp/env/" (name %)) vars)) (map #(str
"java:comp/env/"
(s/replace (name %) #"-" "_")) vars))
(catch javax.naming.NoInitialContextException _ (catch javax.naming.NoInitialContextException _
;; ignore: this only means we're not in a servlet context, ;; ignore: this only means we're not in a servlet context,
;; e.g unit tests. ;; e.g unit tests.

View file

@ -4,31 +4,33 @@
(:require (:require
[ring.middleware.file :refer [wrap-file]] [ring.middleware.file :refer [wrap-file]]
[ring.middleware.file-info :refer [wrap-file-info]] [ring.middleware.file-info :refer [wrap-file-info]]
[ring.server.standalone :refer [app serve]] [ring.server.standalone :refer [serve]]
[smeagol.handler :refer [destroy init]])) [smeagol.handler :refer [app destroy init]])
;; (:import [javax.servlet AsyncContext])
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; ;; ;;;;
;;;; Smeagol: a very simple Wiki engine. ;; ;;;; Smeagol: a very simple Wiki engine.
;;;; ;; ;;;;
;;;; This program is free software; you can redistribute it and/or ;; ;;;; This program is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU General Public License ;; ;;;; modify it under the terms of the GNU General Public License
;;;; as published by the Free Software Foundation; either version 2 ;; ;;;; as published by the Free Software Foundation; either version 2
;;;; of the License, or (at your option) any later version. ;; ;;;; of the License, or (at your option) any later version.
;;;; ;; ;;;;
;;;; This program is distributed in the hope that it will be useful, ;; ;;;; This program is distributed in the hope that it will be useful,
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;;; GNU General Public License for more details. ;; ;;;; GNU General Public License for more details.
;;;; ;; ;;;;
;;;; You should have received a copy of the GNU General Public License ;; ;;;; You should have received a copy of the GNU General Public License
;;;; along with this program; if not, write to the Free Software ;; ;;;; along with this program; if not, write to the Free Software
;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ;; ;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
;;;; USA. ;; ;;;; USA.
;;;; ;; ;;;;
;;;; Copyright (C) 2014 Simon Brooke ;; ;;;; Copyright (C) 2014 Simon Brooke
;;;; ;; ;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defonce server (atom nil)) (defonce server (atom nil))
@ -47,7 +49,7 @@
(defn start-server (defn start-server
"used for starting the server in development mode from REPL" "used for starting the server in development mode from REPL"
[& [port]] [& [port]]
(let [port (if port (Integer/parseInt port) 3000)] (let [port (if port (Integer/parseInt (str port)) 3000)]
(reset! server (reset! server
(serve (get-handler) (serve (get-handler)
{:port port {:port port
@ -60,3 +62,6 @@
(defn stop-server [] (defn stop-server []
(.stop @server) (.stop @server)
(reset! server nil)) (reset! server nil))
;; ;;(start-server 4444)