Skip to content

Commit

Permalink
fix recoursive env
Browse files Browse the repository at this point in the history
  • Loading branch information
arvitaly committed Sep 6, 2016
1 parent c501893 commit 218b3f4
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 22 deletions.
37 changes: 20 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Module for agile interservice-communication with support different transports (l
in1: (data)=>{
setTimeout(()=>{
//call out-link
out.out1("test");
out.out1("test" + env("env1"));
//Create sub-service by services model, services can be add, set, remove, removeAll
services.set({
id: "id1",
Expand All @@ -34,24 +34,27 @@ Module for agile interservice-communication with support different transports (l
}
}
var config = {
transports: {
tr1: {
opts: {
address: "sock"
},
type: "ipc-server"
}
env={
env1: "envValue"
},
transports: {
tr1: {
opts: {
address: "sock"
},
//All calls to out1 will be transported to ipc-server with address "sock" on emit-name "event1"
links: [
{
transport: "tr1",
type: "out",
name: "out1",
to: "event1"
}
]
type: "ipc-server"
}
},
//All calls to out1 will be transported to ipc-server with address "sock" on emit-name "event1"
links: [
{
transport: "tr1",
type: "out",
name: "out1",
to: "event1"
}
]
}
nanoservice(service, config)

#Transports
Expand Down
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
var errors = require('./errors');
var extend = require('deep-extend');
var EventEmitter2 = require('eventemitter2').EventEmitter2;
var serviceController = require('./services');
module.exports = (opts) => {
opts = extend({
opts = Object.assign({
transports: {}
}, opts)
var nanoserviceModule = (service, config) => {
config = extend({
config = Object.assign({
args: null,
services: {},
transports: {},
Expand All @@ -24,6 +23,7 @@ module.exports = (opts) => {
},
services: serviceController(config.services),
env: (name) => {
console.log("name", name)
return config.env[name];
}
});
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nanoservice",
"version": "1.0.2",
"version": "1.0.3",
"description": "Module for agile interservice-communication with support many transports",
"main": "index.js",
"scripts": {
Expand All @@ -19,7 +19,6 @@
},
"homepage": "https://github.com/arvitaly/node-nanoservice#readme",
"dependencies": {
"deep-extend": "^0.4.1",
"eventemitter2": "^2.1.0"
},
"devDependencies": {
Expand Down

0 comments on commit 218b3f4

Please sign in to comment.