0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-13 00:01:51 -05:00
penpot/exporter/src/app/core.cljs
2022-12-22 16:42:45 +01:00

49 lines
1 KiB
Clojure

;; This Source Code Form is subject to the terms of the Mozilla Public
;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;;
;; Copyright (c) KALEIDOS INC
(ns app.core
(:require
["process" :as proc]
[app.browser :as bwr]
[app.common.logging :as l]
[app.config :as cf]
[app.http :as http]
[app.redis :as redis]
[promesa.core :as p]))
(enable-console-print!)
(l/initialize!)
(defn start
[& _]
(l/info :msg "initializing"
:public-uri (str (cf/get :public-uri))
:version (:full @cf/version))
(p/do!
(bwr/init)
(redis/init)
(http/init)))
(def main start)
(defn stop
[done]
;; an empty line for visual feedback of restart
(js/console.log "")
(l/info :msg "stopping")
(p/do!
(bwr/stop)
(redis/stop)
(http/stop)
(done)))
(proc/on "uncaughtException"
(fn [cause]
(js/console.error cause)))
(proc/on "SIGTERM" (fn [] (proc/exit 0)))
(proc/on "SIGINT" (fn [] (proc/exit 0)))