     (when (nil? config-file)
       (exit 2 "Please supply a configuration file via -c option"))
     (let [cfg (read-config-file config-file)]
-      (when-not (valid-config? cfg)
-        (exit 3 "Please fix the configuration file"))
+      (when-let [errors (s/check config-schema cfg)]
+        (exit 3 (str "Please fix the configuration file: " errors)))
       (init! cfg)
       (siphon cfg))))
 

    (log/set-config! [:shared-appender-config :rotor] appender-config)))


(defn valid-config? [c]
  (let [errors (s/check config-schema c)]
    (if (empty? errors)
      c
      (log/warn "The configuration file has invalid values/structure : " errors))))


(defn parse-opt-errors->str [errors]
  (str "There was an error in the command line : \n" (clojure.string/join \newline errors)))


;; and now that some of the not relevant stuff
;; have been moved out is a bit cleaner,
;; but still not clear enough...
;; NEED CLEANER loop
;;
(defn siphon [{:keys [kafka-source elasticsearch-target]}]
  (loop [consumer (connect-to-kafka kafka-source)
