From 98056e815a6dcd36d7377d3cd823a4aaf5a3d9fa Mon Sep 17 00:00:00 2001 From: "Gabriel A. Giovanini" Date: Sat, 17 Feb 2018 13:55:55 -0200 Subject: Initial commit --- env/dev/clj/queue_api/dev_middleware.clj | 10 +++++++++ env/dev/clj/queue_api/env.clj | 14 +++++++++++++ env/dev/clj/user.clj | 16 +++++++++++++++ env/dev/resources/config.edn | 4 ++++ env/dev/resources/logback.xml | 35 ++++++++++++++++++++++++++++++++ env/prod/clj/queue_api/env.clj | 11 ++++++++++ env/prod/resources/config.edn | 2 ++ env/prod/resources/logback.xml | 24 ++++++++++++++++++++++ env/test/resources/config.edn | 4 ++++ env/test/resources/logback.xml | 35 ++++++++++++++++++++++++++++++++ 10 files changed, 155 insertions(+) create mode 100644 env/dev/clj/queue_api/dev_middleware.clj create mode 100644 env/dev/clj/queue_api/env.clj create mode 100644 env/dev/clj/user.clj create mode 100644 env/dev/resources/config.edn create mode 100644 env/dev/resources/logback.xml create mode 100644 env/prod/clj/queue_api/env.clj create mode 100644 env/prod/resources/config.edn create mode 100644 env/prod/resources/logback.xml create mode 100644 env/test/resources/config.edn create mode 100644 env/test/resources/logback.xml (limited to 'env') diff --git a/env/dev/clj/queue_api/dev_middleware.clj b/env/dev/clj/queue_api/dev_middleware.clj new file mode 100644 index 0000000..ece7a25 --- /dev/null +++ b/env/dev/clj/queue_api/dev_middleware.clj @@ -0,0 +1,10 @@ +(ns queue-api.dev-middleware + (:require [ring.middleware.reload :refer [wrap-reload]] + [selmer.middleware :refer [wrap-error-page]] + [prone.middleware :refer [wrap-exceptions]])) + +(defn wrap-dev [handler] + (-> handler + wrap-reload + wrap-error-page + wrap-exceptions)) diff --git a/env/dev/clj/queue_api/env.clj b/env/dev/clj/queue_api/env.clj new file mode 100644 index 0000000..1f31ba5 --- /dev/null +++ b/env/dev/clj/queue_api/env.clj @@ -0,0 +1,14 @@ +(ns queue-api.env + (:require [selmer.parser :as parser] + [clojure.tools.logging :as log] + [queue-api.dev-middleware :refer [wrap-dev]])) + +(def defaults + {:init + (fn [] + (parser/cache-off!) + (log/info "\n-=[queue-api started successfully using the development profile]=-")) + :stop + (fn [] + (log/info "\n-=[queue-api has shut down successfully]=-")) + :middleware wrap-dev}) diff --git a/env/dev/clj/user.clj b/env/dev/clj/user.clj new file mode 100644 index 0000000..843b558 --- /dev/null +++ b/env/dev/clj/user.clj @@ -0,0 +1,16 @@ +(ns user + (:require + [mount.core :as mount] + [queue-api.core :refer [start-app]])) + +(defn start [] + (mount/start-without #'queue-api.core/repl-server)) + +(defn stop [] + (mount/stop-except #'queue-api.core/repl-server)) + +(defn restart [] + (stop) + (start)) + + diff --git a/env/dev/resources/config.edn b/env/dev/resources/config.edn new file mode 100644 index 0000000..6f14c22 --- /dev/null +++ b/env/dev/resources/config.edn @@ -0,0 +1,4 @@ +{:dev true + :port 3000 + ;; when :nrepl-port is set the application starts the nREPL server on load + :nrepl-port 7000} diff --git a/env/dev/resources/logback.xml b/env/dev/resources/logback.xml new file mode 100644 index 0000000..a05ccad --- /dev/null +++ b/env/dev/resources/logback.xml @@ -0,0 +1,35 @@ + + + + + + + UTF-8 + %date{ISO8601} [%thread] %-5level %logger{36} - %msg %n + + + + log/queue-api.log + + log/queue-api.%d{yyyy-MM-dd}.%i.log + + 100MB + + + 30 + + + UTF-8 + %date{ISO8601} [%thread] %-5level %logger{36} - %msg %n + + + + + + + + + + + diff --git a/env/prod/clj/queue_api/env.clj b/env/prod/clj/queue_api/env.clj new file mode 100644 index 0000000..c05d732 --- /dev/null +++ b/env/prod/clj/queue_api/env.clj @@ -0,0 +1,11 @@ +(ns queue-api.env + (:require [clojure.tools.logging :as log])) + +(def defaults + {:init + (fn [] + (log/info "\n-=[queue-api started successfully]=-")) + :stop + (fn [] + (log/info "\n-=[queue-api has shut down successfully]=-")) + :middleware identity}) diff --git a/env/prod/resources/config.edn b/env/prod/resources/config.edn new file mode 100644 index 0000000..b48cfbd --- /dev/null +++ b/env/prod/resources/config.edn @@ -0,0 +1,2 @@ +{:production true + :port 3000} diff --git a/env/prod/resources/logback.xml b/env/prod/resources/logback.xml new file mode 100644 index 0000000..3829eff --- /dev/null +++ b/env/prod/resources/logback.xml @@ -0,0 +1,24 @@ + + + + + log/queue-api.log + + log/queue-api.%d{yyyy-MM-dd}.%i.log + + 100MB + + + 30 + + + UTF-8 + %date{ISO8601} [%thread] %-5level %logger{36} - %msg %n + + + + + + + + diff --git a/env/test/resources/config.edn b/env/test/resources/config.edn new file mode 100644 index 0000000..6f14c22 --- /dev/null +++ b/env/test/resources/config.edn @@ -0,0 +1,4 @@ +{:dev true + :port 3000 + ;; when :nrepl-port is set the application starts the nREPL server on load + :nrepl-port 7000} diff --git a/env/test/resources/logback.xml b/env/test/resources/logback.xml new file mode 100644 index 0000000..a05ccad --- /dev/null +++ b/env/test/resources/logback.xml @@ -0,0 +1,35 @@ + + + + + + + UTF-8 + %date{ISO8601} [%thread] %-5level %logger{36} - %msg %n + + + + log/queue-api.log + + log/queue-api.%d{yyyy-MM-dd}.%i.log + + 100MB + + + 30 + + + UTF-8 + %date{ISO8601} [%thread] %-5level %logger{36} - %msg %n + + + + + + + + + + + -- cgit v1.2.3