+;
+;  (C) Copyright 2016  Pavel Tisnovsky
+;
+;  All rights reserved. This program and the accompanying materials
+;  are made available under the terms of the Eclipse Public License v1.0
+;  which accompanies this distribution, and is available at
+;  http://www.eclipse.org/legal/epl-v10.html
+;
+;  Contributors:
+;      Pavel Tisnovsky
+;
+
 (ns emender-service.core
     "Core module that contains -main function called by Leiningen to start the application.")
 


(require '[clojure.tools.cli       :as cli])

(require '[emender-service.server  :as server])

(def default-port
    "3000")

    ;; 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

