if (Meteor.isServer) {
  Meteor.startup(function () {
    // Validate that the config file contains the data we need.
    validateSettings();

    /* In the mirror process for running automated tests, do not do
     * PowerDNS setup nor UDP pings setup. */
    if (process.env.IS_MIRROR) {
      return;
    }

    // Create our DNS zone for PowerDNS, if necessary.
    mysqlQuery = createWrappedQuery();
    createDomainIfNeeded(mysqlQuery);

    // Bind handlers for UDP-based client ping system.
    startListeningForUdpPings();
  });
}

// Always route all URLs, though we carefully set where: 'server' for
// HTTP API-type URL handling.

Router.map(function() {
  // Redirect the front page to the Sandstorm documentation.
  this.route('root', {
    path: '/',
    where: 'server',
    action: function() {
      this.response.writeHead(302, {
        'Location': 'https://docs.sandstorm.io/en/latest/administering/sandcats/'
      });
      this.response.end();
    }
  });

  this.route('register', {
    path: '/register',
    where: 'server',
    action: function() {
      doRegister(this.request, this.response);
    }
  });

  this.route('reserve', {
    path: '/reserve',
    where: 'server',
    action: function() {
      doReserve(this.request, this.response);
    }
  });

  this.route('registerreserved', {
    path: '/registerreserved',
    where: 'server',
    action: function() {
      doRegisterReserved(this.request, this.response);
    }
  });

  this.route('sendrecoverytoken', {
    path: '/sendrecoverytoken',
    where: 'server',
    action: function() {
      doSendRecoveryToken(this.request, this.response);
    }
  });

  this.route('recover', {
    path: '/recover',
    where: 'server',
    action: function() {
      doRecover(this.request, this.response);
    }
  });

  this.route('update', {
    path: '/update',
    where: 'server',
    action: function() {
      doUpdate(this.request, this.response);
    }
  });

  this.route('getcertificate', {
    path: '/getcertificate',
    where: 'server',
    action: function() {
      doGetCertificate(this.request, this.response);
    }
  });
});

@@ -2121,13 +2121,313 @@
  %7D%0A  %7D);
+%0A%0A  this.route('generate500', %7B%0A    path: '/generate500',%0A    where: 'server',%0A    action: function() %7B%0A      this.response.writeHead(500);%0A      this.response.end(%22500: Fake server error. You have reached an intentional HTTP 500 error page. This server-side route is used for testing.%22);%0A    %7D%0A  %7D);
 %0A%7D);%0A

Add server-side 500 page, to help installer-tests