appconfig.js for Customizing your Parse Server Options

With the expanding eco system of Parse Server modules and the active development of the framework, we are introducing a new cloud code asset with name appconfig.js. This file will allow you to customize the initializaing of your Parse Server in cases where you need to use your own custom developed modules, leveraging modules provided by other SaaS companies and setting configure options currently not available from the NodeChef dashboard. Another possible use case will be enforcing an extra layer of security by enabling client key authentication.

To use this feature is very simple. Create a file with name appconfig.js in your cloud folder and then deploy your cloud code. If you have already deployed your Parse Server, you must perform a one time restart of the Parse Server to enable this feature.To set a configuration option you only need to call a single function providing your configure option name and the option value as seen below.

Server.setConfigureOption( optionName , optionValue );

An example demonstrating how to configure oneSignal as your push provider for the Parse Server in your appconfig.js.

var OneSignalPushAdapter = require('parse-server-onesignal-push-adapter'); // you can set custom environment variables from the dashboard by // navigating to app actions > environment variables var oneSignalPushAdapter = new OneSignalPushAdapter({ oneSignalAppId: process.env.ONE_SIGNAL_APP_ID, oneSignalApiKey: process.env.ONE_SIGNAL_API_KEY }); Server.setConfigureOption('push', { adapter: oneSignalPushAdapter });

Another example on how to configure liveQuery for your Parse Server without hardcoding the name of your classes.

Server.setConfigureOption('liveQuery', { classNames: process.env.MY_LIVE_QUERY_CLASSES.split(',') });

We hope this provides you the much needed flexibility to run your Parse Server.

SIGN UP NOW