pnxtech / hydra

A light-weight library for building distributed applications such as microservices
https://www.hydramicroservice.com
MIT License
645 stars 54 forks source link

Unable to connect to redis #36

Closed RohovDmytro closed 7 years ago

RohovDmytro commented 7 years ago

index.js

const hydra = require('fwsp-hydra'),
      configJSON = require('./config.json');

hydra.init(configJSON)

config.json

{
  "hydra": {
    "serviceName": "youtube-fetcher",
    "serviceIP": "127.0.0.1",
    "servicePort": 3001,
    "serviceType": "test",
    "serviceDescription": "",
    "redis": {
      "url": "...",
      "port": "...",
      "db": 0
    }
  }
}

url and port are hidden for purpose.

Terminal

Unable to establish a connection to Redis
RohovDmytro commented 7 years ago

Okay. Seems that docs are misleading 😞

From https://github.com/flywheelsports/fwsp-hydra/blob/master/documentation.md

hydra.init(initObject)

needs to be

hydra.init(initObject.hydra)

because you are saying that

The initialization object consist of the following fields:

hydra: {
  serviceName: 'hydramcp',
  serviceDescription: 'Hydra Master Control Program',
  serviceIP: '',
  servicePort: 0,
  serviceType: 'mcp',
  redis: {
    url: '127.0.0.1',
    port: 6379,
    db: 0
  }
}
emadum commented 7 years ago

@rogovdm Yes the docs aren't clear there. I'll update them, thanks for the feedback!