 
 (require '[clojure.tools.cli       :as cli])
 
-(require '[emender-service.server  :as server])
+(require '[emender-service.server      :as server])
+(require '[emender-service.config      :as config])
+(require '[emender-service.middleware  :as middleware])
 
 (def default-port
     "3000")

(ns emender-service.core
    "Core module that contains -main function called by Leiningen to start the application.")


    ;; an option with a required argument
    [["-p" "--port   PORT"    "port number"   :id :port]])

; we need to load the configuration in advance so the 'app' could use it
(def configuration (config/load-configuration "emender-service.ini"))

(def app
    "Definition of a Ring-based application behaviour."
    (-> server/handler            ; handle all events
        (middleware/inject-configuration configuration) ; inject configuration structure into the parameter
        cookies/wrap-cookies      ; we need to work with cookies
        http-params/wrap-params)) ; and to process request parameters, of course

