aboutsummaryrefslogtreecommitdiff
path: root/env/dev
diff options
context:
space:
mode:
Diffstat (limited to 'env/dev')
-rw-r--r--env/dev/clj/queue_api/dev_middleware.clj10
-rw-r--r--env/dev/clj/queue_api/env.clj14
-rw-r--r--env/dev/clj/user.clj16
-rw-r--r--env/dev/resources/config.edn4
-rw-r--r--env/dev/resources/logback.xml35
5 files changed, 79 insertions, 0 deletions
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration>
+ <statusListener class="ch.qos.logback.core.status.NopStatusListener" />
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <!-- encoders are assigned the type
+ ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
+ <encoder>
+ <charset>UTF-8</charset>
+ <pattern>%date{ISO8601} [%thread] %-5level %logger{36} - %msg %n</pattern>
+ </encoder>
+ </appender>
+ <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>log/queue-api.log</file>
+ <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+ <fileNamePattern>log/queue-api.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+ <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+ <maxFileSize>100MB</maxFileSize>
+ </timeBasedFileNamingAndTriggeringPolicy>
+ <!-- keep 30 days of history -->
+ <maxHistory>30</maxHistory>
+ </rollingPolicy>
+ <encoder>
+ <charset>UTF-8</charset>
+ <pattern>%date{ISO8601} [%thread] %-5level %logger{36} - %msg %n</pattern>
+ </encoder>
+ </appender>
+ <logger name="org.apache.http" level="warn" />
+ <logger name="org.xnio.nio" level="warn" />
+ <logger name="io.undertow.session" level="warn" />
+ <logger name="io.undertow.request" level="warn" />
+ <root level="DEBUG">
+ <appender-ref ref="STDOUT" />
+ <appender-ref ref="FILE" />
+ </root>
+</configuration>