Working towards lein-adl

This commit is contained in:
Simon Brooke 2018-07-21 11:50:38 +01:00
parent 3b11b678a1
commit 912d417cb6
3 changed files with 88 additions and 90 deletions

View file

@ -2,4 +2,5 @@
:port 8765
:site-title "Project Hope"
:site-logo "img/ProjectHopeLogo.png"
:motd "motd.md"}
:motd "motd.md"
:app-context "/youyesyet"}

View file

@ -54,7 +54,8 @@
:main ^:skip-aot youyesyet.core
:migratus {:store :database :db ~(get (System/getenv) "DATABASE_URL")}
:plugins [[lein-cljsbuild "1.1.4"]
:plugins [[lein-adl ["0.1.1"]]
[lein-cljsbuild "1.1.4"]
[lein-codox "0.10.3"]
[lein-cprop "1.0.1"]
[lein-less "1.7.5"]
@ -64,7 +65,6 @@
[migratus-lein "0.4.2"]
[org.clojars.punkisdead/lein-cucumber "1.0.5"]]
:cucumber-feature-paths ["test/clj/features"]
:codox {:metadata {:doc "FIXME: write docs"}
@ -82,36 +82,34 @@
:release-tasks [["vcs" "assert-committed"]
["change" "version" "leiningen.release/bump-version" "release"]
["adl"]
["vcs" "commit"]
;; ["vcs" "tag"] -- not working, problems with secret key
["clean"]
["npm" "install"]
["ring" "uberjar"]
["uberjar"]
[uberwar]
["docker" "build"]
["docker" "push"]
["change" "version" "leiningen.release/bump-version"]
["vcs" "commit"]]
:uberwar
{:handler youyesyet.handler/app
:uberwar {:handler youyesyet.handler/app
:init youyesyet.handler/init
:destroy youyesyet.handler/destroy
:name "youyesyet.war"}
:clean-targets ^{:protect false}
[:target-path [:cljsbuild :builds :app :compiler :output-dir]
:clean-targets ^{:protect false} [:target-path [:cljsbuild :builds :app :compiler :output-dir]
[:cljsbuild :builds :app :compiler :output-to]]
:figwheel
{:http-server-root "public"
:figwheel {:http-server-root "public"
:nrepl-port 7002
:css-dirs ["resources/public/css"]
:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]}
:profiles
{:uberjar {:omit-source true
:prep-tasks ["compile" ["cljsbuild" "once" "min"]]
:profiles {:uberjar {:omit-source true
:prep-tasks ["adl" "compile" ["cljsbuild" "once" "min"]]
:cljsbuild
{:builds
{:min
@ -123,14 +121,13 @@
:closure-warnings
{:externs-validation :off :non-standard-jsdoc :off}
:externs ["react/externs/react.js"]}}}}
:aot :all
:uberjar-name "youyesyet.jar"
:source-paths ["env/prod/clj"]
:resource-paths ["env/prod/resources"]}
:dev [:project/dev :profiles/dev]
:test [:project/dev :project/test :profiles/test]
:project/dev {:dependencies [[prone "1.1.4"]
@ -148,8 +145,7 @@
[lein-doo "0.1.7"]
[lein-figwheel "0.5.15"]
[org.clojure/clojurescript "1.9.495"]]
:cljsbuild
{:builds
:cljsbuild {:builds
{:app
{:source-paths ["src/cljs" "src/cljc" "env/dev/cljs"]
:compiler
@ -175,8 +171,6 @@
{:output-to "target/test.js"
:main "youyesyet.doo-runner"
:optimizations :whitespace
:pretty-print true}}}}
}
:pretty-print true}}}}}
:profiles/dev {}
:profiles/test {}})

View file

@ -21,13 +21,16 @@
;; .getContextPath might not exist
(try (.getContextPath ^ServletContext context)
(catch IllegalArgumentException err
(log/warn "Failed to initialise servlet-context: " (.getMessage err))
(log/warn "Failed to initialise *app-context*: " (.getMessage err))
context))
;; if the context is not specified in the request
;; we check if one has been specified in the environment
;; instead
(:app-context env))]
(handler request))))
(do
(log/info "Taking '" (:app-context env) "' as *app-context* from env")
(:app-context env)))]
(log/debug "Using '" *app-context* "' as *app-context*")
(handler (assoc request :servlet-context *app-context*)))))
(defn wrap-internal-error [handler]