Error when using redis as websocket store



  • So i'm trying to use redis as websocket store because of clustering but after i add redis section to config.json and start nodebb i get error.

    Starting NodeBB
      "./nodebb stop" to stop the NodeBB server
      "./nodebb log" to view server output
      "./nodebb restart" to restart NodeBB
    
     /path/to/nodebb/node_modules/nconf/lib/nconf/stores/file.js:141
          throw new Error("Error parsing your configuration file: [" + self.file +
                ^
    Error: Error parsing your configuration file: [/path/to/nodebb/config.json]: Unexpected string
        at File.loadSync (/path/to/nodebb/node_modules/nconf/lib/nconf/stores/file.js:141:13)
        at Provider.add (/path/to/nodebb/node_modules/nconf/lib/nconf/provider.js:137:23)
        at Provider.file (/path/to/nodebb/node_modules/nconf/lib/nconf/provider.js:63:15)
        at Object.<anonymous> (/path/to/nodebb/loader.js:14:20)
        at Module._compile (module.js:460:26)
        at Object.Module._extensions..js (module.js:478:10)
        at Module.load (module.js:355:32)
        at Function.Module._load (module.js:310:12)
        at Function.Module.runMain (module.js:501:10)
        at startup (node.js:129:16)
    

    My config.json with redis added

     {
        "url": "http://nodebbsite.tld",
        "port": ["4567", "4568", "4569", "4570"],
        "secret": "***",
        "database": "mongo",
        "mongo": {
            "host": "127.0.0.1",
            "port": "27017",
            "username": "***",
            "password": "***",
            "database": "***"
        }
        "redis": {
           "host":"127.0.0.1",
           "port":"6379",
           "username":"",
           "password":"",
           "database":"0"
        }
    }
    

    Any ideas how to fix this?


  • Staff Admin

    You are missing a , in your config json after the mongo block it should be

    {
        "url": "http://nodebbsite.tld",
        "port": ["4567", "4568", "4569", "4570"],
        "secret": "***",
        "database": "mongo",
        "mongo": {
            "host": "127.0.0.1",
            "port": "27017",
            "username": "***",
            "password": "***",
            "database": "***"
        },
        "redis": {
           "host":"127.0.0.1",
           "port":"6379",
           "username":"",
           "password":"",
           "database":"0"
        }
    }
    


  • That seems to do the trick.
    Thanks 😉


Log in to reply
 

Suggested Topics

  • 13
  • 17
  • 2
  • 3
  • 8
| |