      (cond
        (:help options) (exit 0 (usage summary))
        errors (exit 1 (error-msg errors)))
-     (start-server port (:okta-active options) (:environment options))))
+     (start-server port (:okta-active options) (:environment options) (:okta-home options))))

(def cli-options
  ;; An option with a required argument
  [["-o" "--okta-active"]
   ["-e" "--environment ENV" "Environment name, e.g. ci"
    :default "local"]
   ["-h" "--help"]])

(defn error-msg [errors]

  (System/exit status))


(defn do-wrap-okta [handler okta-active env okta-home]
  (let [config-res (io/resource (str "okta-" env "-config.xml"))]
    (println "initialize okta?" okta-active " config location: " config-res)
    (if okta-active
      (wrap-okta handler {:okta-home okta-home :okta-config config-res})
      handler)))

(defn start-server [port okta-active env okta-home]
  (let [app (-> (app (db-handler/connect))
                (do-wrap-okta okta-active env okta-home)
                (ring-logger/wrap-with-logger)
                (session/wrap-session))]
    (run-jetty app {:port port :join? false})))
