Update Parse Server options programmatically

I’m looking to enable/disable email verification on demand. Also other options like expireInactiveSessions or preventLoginWithUnverifiedEmail would be interesting to set programmatically. To be very clear, the idea is to have an UI to update some Parse Server options.

Any advice?

In general, it is currently not supported nor advised to change Parse Server (module) configurations after launch, unless for parameters where it is explicitly offered in the docs.

The server architecture makes some processes run only once during Parse Server setup, so trying to change anything thereafter would likely result in a misconfigured server. Even if you are able to hack this together, it could break anytime in the future, as there is currently no architecture policy that says that a feature has to be reconfigurable.

I think the functionality you look for would require a feature requests.

Depending on your use case, you may try to run two Parse Servers with different configurations accessing the same DB. Depending on whether you require verified emails or not, you can use the appropriate Parse Server URL.

In addition, the Parse iOS and Android SDK offer you an option to reconfigure the Parse Server URL that SDK connects to, without having to reinitialize the SDK, which may be useful for your use case.

Thank you for the detailed reply, @mtrezza.

Yes, it would be nice in the future to have a public API to update some options, like email verification. For example:

const api = new ParseServer({...})

// later 

api.enableEmailVerification(true);
api.enableEmailVerification(false);

// or update directly the config:

api.preventLoginWithUnverifiedEmail = false
api.preventLoginWithUnverifiedEmail = true