Hi All,
As I understand it using the new module workers syntax, environment variables are passed to the handler. I can successfully access these when handling a fetch, but my issue is that the structure of my app is not friendly to the idea of to trickle-down environment variables. The database instance, for example, is a global that is instantiated on init, before the first request.
Is the official solution to stuff all that env-dependent logic into the fetch handler and pass it down as context? Sounds great if it were a pure functional language, but in JS it's just easier to separate domains via module and import as needed.
Any advice would be greatly appreciated.