Multiple environments

I am soon planning to launch into production with Moralis, but before that I would like to set up multiple environments (e.g. dev, stage, prod).

This docs section on environment variables is seriously lacking any guidance on how to set this up.

Would be super thankful if you could add a bit more info.

For different environments I would recommend to use different servers right now

We still have work to do on making it a better experience - for example we want to provide a way to easily copy servers, programmatically change event settings etc it’s all in the pipeline

For now using 1 moralis sever per environment is the solution for different environments

Does that make sense?
Also let me know what kind of features you would want to see in terms of different environments

1 Like

I agree, 1 server/environment.

However, there are some configs that are specific to environment, and I am wondering what is the best way to load them dynamically into the server (cloud functions specifically). At the moment it doesn’t seem possible to do this with moralis. One way would be to read from a database table in cloud functions but that sounds hacky.

If there is some way to use dotenv in cloud functions i think it would solve the problem.

You should be able to set config variables if you go to Config section in your Dashboard (where the database UI is)

You can then read them from cloud functions using the documentation you linked about Config

Try that