I'm starting to think it might be nice to have a file like .hz/server.js where you can programmatically interact with the Horizon server before it's launched. This would be run and work both locally and when deployed to Horizon Cloud. I think this has a couple advantages:
The way this might work is that your .hz/server.js would export a single function that takes the Horizon server instance and lets you do whatever you want with it. After the server is started and any default configuration is applied, this file gets required and passed the Horizon server instance:
// .hz/server.js
module.exports = function (Horizon) {
Horizon.command('custom', (params) => {
// custom command implementation
})
}
This seems like a reasonable idea. There is definitely a point where too many config options is way worse than just providing a nice javascript interface.
Most helpful comment
This seems like a reasonable idea. There is definitely a point where too many config options is way worse than just providing a nice javascript interface.