diff options
author | Griffin Smith <grfn@gws.fyi> | 2021-12-14T02·28-0500 |
---|---|---|
committer | Griffin Smith <grfn@gws.fyi> | 2021-12-14T02·45-0500 |
commit | c3cb7b0df82479016c252ef45a302f566bd569f6 (patch) | |
tree | 2f60fac21680a379950c7d34c2e12304e10cc115 /users/grfn/bbbg/src/bbbg/core.clj | |
parent | 479e9ea279a157d81964a9b8cc97423b484921e6 (diff) |
feat(grfn/bbbg): Init r/3233
This will eventually become a signup sheet + no-show tracker for my local board game meetup group Change-Id: Id8d1d80d95d1e2fda5041275cff2fecfd6fa43f1
Diffstat (limited to 'users/grfn/bbbg/src/bbbg/core.clj')
-rw-r--r-- | users/grfn/bbbg/src/bbbg/core.clj | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/users/grfn/bbbg/src/bbbg/core.clj b/users/grfn/bbbg/src/bbbg/core.clj new file mode 100644 index 000000000000..70c7da50d502 --- /dev/null +++ b/users/grfn/bbbg/src/bbbg/core.clj @@ -0,0 +1,58 @@ +(ns bbbg.core + (:gen-class) + (:require + [bbbg.db :as db] + [bbbg.web :as web] + [clojure.spec.alpha :as s] + [clojure.spec.test.alpha :as stest] + [com.stuartsierra.component :as component] + [expound.alpha :as exp])) + +(s/def ::config + (s/merge + ::db/config + ::web/config)) + +(defn make-system [config] + (component/system-map + :db (db/make-database config) + :web (web/make-server config))) + +(defn env->config [] + (s/assert + ::config + (merge + (db/env->config) + (web/env->config)))) + +(defn dev-config [] + (s/assert + ::config + (merge + (db/dev-config) + (web/dev-config)))) + +(defonce system nil) + +(defn init-dev [] + (s/check-asserts true) + (set! s/*explain-out* exp/printer) + (stest/instrument)) + +(defn run-dev [] + (init-dev) + (alter-var-root + #'system + (fn [sys] + (when sys + (component/start sys)) + (component/start (make-system (dev-config)))))) + +(defn -main [& _args] + (alter-var-root + #'system + (constantly (component/start (make-system (env->config)))))) + +(comment + (run-dev) + ) |