In my app I want to execute some code after the system has been initiated successfully. What is the proper way of doing this?
Generally speaking, after initialization, code will be executed by HTTP requests / cron tasks
Not sure what you're trying to do?
I want to run a setup script for my web app (create stuff that have to be there etc). The script will be idempotent so I would not care if it runs after every system initialization
As in database rows?
Including database rows
Ok, I don't think there's really a reason everything needs to be started, right? As long as the database connection is established. You could create an init-key that references :duct.database/sql
, and does what it needs to do
Basically just reference whichever keys need to be started before this one
Ok so this is what my initial thought was, I asked to see if there is something like a callback to a successful initialization or smth
Thanks a lot @kevin.van.rooijen
AFAIK, there isn't
:thumbsup:
https://github.com/duct-framework/core/blob/master/src/duct/core.clj#L213-L233 looks like exec-config
just starts the system and checks of there are any :duct/daemon
keys. If there are, it adds a shutdown hook and blocks infinitely
Doesn't look like there is any extra logic for hooks and stuff
Yeah looks like it
Added here: https://github.com/duct-framework/duct/wiki/Modules