You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This thread is about the discussion around the topic so it should stay open for a while.
The idea is that the library shouldn't actually be doing the configuration because it violates the primary concerns of comedy.
As most advanced use cases would just use their own config loading.
However, hot-loading is very useful.
So I see a number of options:
1. make hot-loading configurable: by providing a custom handler and an array of files to watch:
constCONFIG_FILES=['file1.json','file2.yaml']comedy.setConfigLoader(CONFIG_FILES,(changedfile)=>{// custom parsing and handling// then return the updated config in the JSON format currently read directly from filesreturn{};})
2. rip out hot-loader functionality and just provide a hot-update function, maybe making another library
importhotloaderfrom`@comedy/hotloader`hotloader.watch('file1.json',()=>{// callback fires on config changes// custom parsing and handlingconstconfig={};// then return the updated config as a JSON object in the format currently read directly from filescomedy.updateConfig(config);}hotloader.watch('file2.yaml',()=>{// callback fires on config changes// custom parsing and handlingconstconfig={};// then call update with updated config as a JSON object in the format currently read directly from filescomedy.updateConfig(config);}
there are likely other options, the biggest issue is backwards compatibility,
I lean towards option 2 because it keeps comedy focussed on what it should, which is the actor system, and you can
keep BC if you detect that the @comedy/hotloader module is installed and the config option is set as a path to a json file and not a json object (which it should support as well)
The text was updated successfully, but these errors were encountered:
This thread is about the discussion around the topic so it should stay open for a while.
The idea is that the library shouldn't actually be doing the configuration because it violates the primary concerns of comedy.
As most advanced use cases would just use their own config loading.
However, hot-loading is very useful.
So I see a number of options:
1. make hot-loading configurable: by providing a custom handler and an array of files to watch:
2. rip out hot-loader functionality and just provide a hot-update function, maybe making another library
there are likely other options, the biggest issue is backwards compatibility,
I lean towards option 2 because it keeps comedy focussed on what it should, which is the actor system, and you can
keep BC if you detect that the
@comedy/hotloader
module is installed and theconfig
option is set as a path to a json file and not a json object (which it should support as well)The text was updated successfully, but these errors were encountered: