How to switch environment in SDK?

So to setup the moralis server in SDK, we are doing ā€œMoralis.start(SERVER_INFO)ā€, thing is we want to have multiple environments, so both ā€œtestnetā€ and ā€œmainnetā€ in the same app - bad planning and we add it to an existing infrastructure that doesnā€™t allow us to have 2 different domains for theseā€¦

So Iā€™m asking, if I can do Moralis.start(), is there a Moralis.stop() somewhere? or Moralis.switchServer() or something of the like?

I found an undocumented ā€œcleanup: () => Promise;ā€ function, which seems to work? but Iā€™m not sure if thatā€™s the right thing to useā€¦

Iā€™m thinking that you can do some kind of initial initialisation of the app with one of the two, and you restart the app when you want to change the environment

1 Like