Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

There was an error processing your settings.json file: process is not defined

There was an error processing your settings.json file: process is not defined

Problem

when I push my code of Etherpad, it said that

[31m[2012-11-03 15:14:00.102] [ERROR] console - [39mThere was an error process ing your settings.Json file: process is not defined

this key code is below

/*
  This file must be valid JSON. But comments are allowed

  Please edit settings.json, not settings.json.template
*/
{
  //Ip and port which etherpad should bind at
  "ip": process.env.VCAP_APP_HOST,
  "port" : process.env.VCAP_APP_POR,

  //The Type of the database. You can choose between dirty, postgres, sqlite and mysql
  //You shouldn't use "dirty" for for anything else than testing or development
  /*"dbType" : "dirty",*/
  //the database specific settings
  /*"dbSettings" : {
                   "filename" : "var/dirty.db"
                 },*/

  /* An Example of MySQL Configuration */
   "dbType" : "mysql",
   "dbSettings" : {
                    "user"    : process.env.VCAP_SERVICES["etherpadDB"][0]["credentials"]["user"], 
                    "host"    : process.env.VCAP_SERVICES["etherpadDB"][0]["host"], 
                    "password": process.env.VCAP_SERVICES["etherpadDB"][0]["password"], 
                    "database": process.env.VCAP_SERVICES["etherpadDB"][0]["name"]
                  },



}
Problem courtesy of: cyong

Solution

This is surely because your file is not valid JSON. JSON does not have a value type of "process." If you rewrite the file using the actual values rather than references, it should work.

So instead of:

"ip": process.env.VCAP_APP_HOST

use the value of the referenced variable, as in:

"ip": "10.0.0.1"

See http://www.json.org/ for how to write JSON.

EDIT

Since you need to update the contents of the JSON config file from variables that Cloud Foundry keeps in the process environment, you'll need to modify your EtherPad Lite installation to rebuild the settings.json file each time you start EtherPad Lite.

Please see:

https://github.com/raisch/sandbox/blob/master/EtherPadLite-CloudFoundry/buildConfigFile.js

for instructions on how to update your EtherPad Lite.

Please note that as I do not have an account at Cloud Foundry, I cannot test this in place. However, assuming that the process environment contains the values you reference in your example, this will create a valid settings.json file every time you start your EtherPad Lite instance.

Solution courtesy of: Rob Raisch

Discussion

View additional discussion.



This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

There was an error processing your settings.json file: process is not defined

×

Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription

×