import { ParseServer } from 'parse-server';
import Parse from 'parse/node';
import ParseDashboard from 'parse-dashboard';

export default {
  setup(app, appName, settings, allowInsecureHTTPInParseDashboard = false) {
    Parse.initialize(settings.parseServerApplicationId, 'js-key', settings.parseServerMasterKey);
    Parse.serverURL = settings.parseServerURL;

    const api = new ParseServer({
      appId: settings.parseServerApplicationId,
      masterKey: settings.parseServerMasterKey,
      serverURL: settings.parseServerURL,
      databaseURI: settings.parseServerDatabaseURI,
    });

    app.use('/parse', api);

    app.use(
      '/dashboard',
      // eslint-disable-next-line new-cap
      ParseDashboard({
        apps: [{
          serverURL: settings.parseServerURL,
          appId: settings.parseServerApplicationId,
          masterKey: settings.parseServerMasterKey,
          appName,
          iconName: 'logo.png',
        }],
        iconsFolder: 'public/images',
        users: settings.parseServerDashboardUsers,
      }, allowInsecureHTTPInParseDashboard)
    );
  },
};

@@ -585,24 +585,142 @@
 I,%0A    %7D);%0A%0A
+    const iconsFolder = process.env.NODE_ENV === 'development' ?%0A      './server/public/images' : './public/images';%0A%0A
     app.use(
@@ -1087,25 +1087,8 @@
 lder
-: 'public/images'
 ,%0A  

fix #39