Heaven (reloading)
Heaven powers up env runtime reloading.
Restarting a process is really annoying, especially when dealing with slow builds, fatima helps you with that by providing "Heaven", a runtime env reloading solution.
Heaven, runtime reloading
To enable runtime reloading, we will use fatima/heaven
with the watch
method.
Only during development
heaven.watch()
only runs listens for changes if you execute your app with
fatima dev
, otherwise it will be ignored.
Needs to be executed
If your framework does not support hooks, or for some reason you can't tweak the app entry file, you can't use Heaven runtime reloading.
Watching local changes
Local changes are automatically detected by Heaven, you don't need to do anything.
.env.example
.env.example
is ignored by Heaven watch feature, you can use it to document
your environment variables.
Watching cloud changes
For watching cloud changes, you need to setup a webhook in your secret manager.
Heaven natively runs on port 15781
, but you can explicitly set the heaven
option in your fatima.config.ts
.
This will spin up an endpoint at http://localhost:15781/fatima
accepting any HTTP method to trigger a reload.
It is your job to provide the tunneling service, here's a list of services you can use:
For much more, check the Awesome Tunneling repo
After setting up the tunneling you just need to set the webhook URL in your secret manager to the endpoint URL.
My secret manager does not support webhooks
This usually happens with tools that have a secret manager but aren't secret managers themselves: vercel, railway, trigger.dev, etc.
In this case, you can use the fatima reload
command to trigger a reload.
You can run this command on a second terminal without stopping your process.