Skip to content

Commit

Permalink
service: mulog donut config for user repl startup
Browse files Browse the repository at this point in the history
  • Loading branch information
practicalli-johnny committed Apr 8, 2024
1 parent 7b91792 commit cc9577a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
!compose.yaml
!Dockerfile
!.dockerignore
!**/.clj-kondo/config.edn
!Makefile
!tests.edn

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 23 additions & 3 deletions resources/practicalli/service/dev/system_repl_donut.clj.template
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -34,3 +53,4 @@
(defn system
"Return: fully qualified hash-map of system state"
[] donut-repl-state/system)
;; ---------------------------------------------------------

0 comments on commit cc9577a

Please sign in to comment.