From cc9577a2d9bb43e5b2d788d87829d96bd53a2ffa Mon Sep 17 00:00:00 2001 From: Practicalli Engineering Date: Mon, 8 Apr 2024 15:48:54 +0100 Subject: [PATCH] service: mulog donut config for user repl startup --- .gitignore | 1 + CHANGELOG.md | 1 + .../dev/system_repl_donut.clj.template | 26 ++++++++++++++++--- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index f5a9622..35147ba 100644 --- a/.gitignore +++ b/.gitignore @@ -33,6 +33,7 @@ !compose.yaml !Dockerfile !.dockerignore +!**/.clj-kondo/config.edn !Makefile !tests.edn diff --git a/CHANGELOG.md b/CHANGELOG.md index e367536..d36404c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file. This change - service: move mulog publisher inside donut system config - readme: simplify readme, add overview, remove older examples - service: refactor template-edn function to aid diagnosis +- service: mulog donut config for user repl startup # 2024-01-23 ## Changed diff --git a/resources/practicalli/service/dev/system_repl_donut.clj.template b/resources/practicalli/service/dev/system_repl_donut.clj.template index 220a767..68dba89 100644 --- a/resources/practicalli/service/dev/system_repl_donut.clj.template +++ b/resources/practicalli/service/dev/system_repl_donut.clj.template @@ -13,13 +13,32 @@ [{{top/ns}}.{{main/ns}}.system :as system])) +;; --------------------------------------------------------- +;; Donut named systems +;; `:donut.system/repl` is default named system, +;; bound to `{{top/ns}}.{{main/ns}}.system` configuration (defmethod donut/named-system :donut.system/repl [_] system/main) +;; `dev` system, partially overriding main system configuration +;; to support the development workflow +(defmethod donut/named-system :dev + [_] (donut/system :donut.system/repl + {[:env :app-env] "dev" + [:env :app-version] "0.0.0-SNAPSHOT" + [:services :http-server ::donut/config :options :join?] false + [:services :event-log-publisher ::donut/config] + {:publisher {:type :console :pretty? true}}})) +;; --------------------------------------------------------- + +;; --------------------------------------------------------- +;; Donut REPL workflow helper functions + (defn start - "Start system with donut, optionally passing a named system" - ([] (donut-repl/start)) - ([system-config] (donut-repl/start system-config))) + "Start services using a named-system configuration, + use `:dev` named-system by default" + ([] (start :dev)) + ([named-system] (donut-repl/start named-system))) (defn stop "Stop the currently running system" @@ -34,3 +53,4 @@ (defn system "Return: fully qualified hash-map of system state" [] donut-repl-state/system) +;; ---------------------------------------------------------