backend: warning when started without DB_SEED

This commit is contained in:
Johannes Lötzsch 2022-03-11 17:10:07 +01:00
parent 73bdda8fa2
commit 1f5154e2af
3 changed files with 9 additions and 10 deletions

View File

@ -16,7 +16,7 @@
(s/def ::db-inmemory boolean?) ;; we run unit tests in an in-memory instance, otherwise the default db would be looked
(s/def ::db-dir string?) ;; ignored when ::db-inmemory
(s/def ::db-seed string?) ;; an edn-file to be used for seeding
(s/def ::db-seed (s/nilable string?)) ;; an edn-file to be used for seeding
(s/def ::db-export-prefix (s/nilable string?)) ;; path where during startup an export should be written
(s/def ::db-validate boolean?)

View File

@ -63,14 +63,13 @@
(export-named-by-date db_ctx "start") ;; before seeding
(let [seed-file (when (not-empty (:db-seed env))
(:db-seed env)
;; TODO configuration for tests
#_(io/resource "beherbergung/db/seed/test.edn"))]
(when (:verbose env)
(println "Seed the database from:" seed-file))
(when seed-file
(seed seed-file db_ctx)))
;; There is no default seed file, to prevent loading it into the production system
(if (:db-seed env)
(do (when (:verbose env)
(println "Seed the database from:" (:db-seed env)))
(seed (:db-seed env) db_ctx))
(println "WARNING: Seeding the database requires setting $DB_SEED"
"consider: DB_SEED=src/beherbergung/db/seed/test.edn"))
(if (:db-validate env)
(or (validate-db db_ctx)

View File

@ -6,7 +6,7 @@
:db-inmemory false
:db-dir "./data/xtdb/rocksdb"
:db-seed ""
:db-seed nil
:db-export-prefix "./data/export/"
:db-validate true