diff --git a/coverage/coverage.json b/coverage/coverage.json
deleted file mode 100644
index ffbe34a..0000000
--- a/coverage/coverage.json
+++ /dev/null
@@ -1 +0,0 @@
-{"/Users/emmanuelnyachoke/Code/Mekom/con-tainer2sul/lib/consul/catalog.js":{"path":"/Users/emmanuelnyachoke/Code/Mekom/con-tainer2sul/lib/consul/catalog.js","s":{"1":3,"2":1,"3":1,"4":1},"b":{},"f":{"1":3,"2":1,"3":1},"fnMap":{"1":{"name":"(anonymous_1)","line":4,"loc":{"start":{"line":4,"column":14},"end":{"line":4,"column":23}}},"2":{"name":"(anonymous_2)","line":8,"loc":{"start":{"line":8,"column":11},"end":{"line":8,"column":18}}},"3":{"name":"(anonymous_3)","line":12,"loc":{"start":{"line":12,"column":13},"end":{"line":12,"column":20}}}},"statementMap":{"1":{"start":{"line":5,"column":4},"end":{"line":5,"column":25}},"2":{"start":{"line":9,"column":4},"end":{"line":9,"column":58}},"3":{"start":{"line":13,"column":4},"end":{"line":13,"column":60}},"4":{"start":{"line":17,"column":0},"end":{"line":17,"column":25}}},"branchMap":{}},"/Users/emmanuelnyachoke/Code/Mekom/con-tainer2sul/lib/consul/kv.js":{"path":"/Users/emmanuelnyachoke/Code/Mekom/con-tainer2sul/lib/consul/kv.js","s":{"1":5,"2":1,"3":1,"4":1,"5":1,"6":1,"7":0,"8":1,"9":1},"b":{"1":[0,1]},"f":{"1":5,"2":1,"3":1,"4":1,"5":1},"fnMap":{"1":{"name":"(anonymous_1)","line":4,"loc":{"start":{"line":4,"column":14},"end":{"line":4,"column":23}}},"2":{"name":"(anonymous_2)","line":8,"loc":{"start":{"line":8,"column":7},"end":{"line":8,"column":16}}},"3":{"name":"(anonymous_3)","line":12,"loc":{"start":{"line":12,"column":6},"end":{"line":12,"column":19}}},"4":{"name":"(anonymous_4)","line":16,"loc":{"start":{"line":16,"column":6},"end":{"line":16,"column":12}}},"5":{"name":"(anonymous_5)","line":20,"loc":{"start":{"line":20,"column":9},"end":{"line":20,"column":24}}}},"statementMap":{"1":{"start":{"line":5,"column":4},"end":{"line":5,"column":25}},"2":{"start":{"line":9,"column":4},"end":{"line":9,"column":53}},"3":{"start":{"line":13,"column":4},"end":{"line":13,"column":52}},"4":{"start":{"line":17,"column":4},"end":{"line":17,"column":49}},"5":{"start":{"line":21,"column":4},"end":{"line":21,"column":30}},"6":{"start":{"line":23,"column":4},"end":{"line":25,"column":5}},"7":{"start":{"line":24,"column":6},"end":{"line":24,"column":24}},"8":{"start":{"line":27,"column":4},"end":{"line":27,"column":36}},"9":{"start":{"line":31,"column":0},"end":{"line":31,"column":20}}},"branchMap":{"1":{"line":23,"type":"if","locations":[{"start":{"line":23,"column":4},"end":{"line":23,"column":4}},{"start":{"line":23,"column":4},"end":{"line":23,"column":4}}]}}},"/Users/emmanuelnyachoke/Code/Mekom/con-tainer2sul/lib/errors/skipError.js":{"path":"/Users/emmanuelnyachoke/Code/Mekom/con-tainer2sul/lib/errors/skipError.js","s":{"1":1,"2":1},"b":{},"f":{"1":1},"fnMap":{"1":{"name":"(anonymous_1)","line":4,"loc":{"start":{"line":4,"column":14},"end":{"line":4,"column":20}}}},"statementMap":{"1":{"start":{"line":5,"column":4},"end":{"line":5,"column":15}},"2":{"start":{"line":9,"column":0},"end":{"line":9,"column":27}}},"branchMap":{}},"/Users/emmanuelnyachoke/Code/Mekom/con-tainer2sul/lib/consul/index.js":{"path":"/Users/emmanuelnyachoke/Code/Mekom/con-tainer2sul/lib/consul/index.js","s":{"1":1,"2":1,"3":1,"4":6,"5":6,"6":6,"7":6,"8":2,"9":2,"10":2,"11":2,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":2,"20":1,"21":2,"22":1,"23":2,"24":1,"25":2,"26":1,"27":1,"28":1,"29":1},"b":{"1":[6,6],"2":[2,0],"3":[1,1],"4":[0,0],"5":[1,1],"6":[1,1]},"f":{"1":6,"2":2,"3":1,"4":2,"5":1,"6":1,"7":1},"fnMap":{"1":{"name":"(anonymous_1)","line":7,"loc":{"start":{"line":7,"column":13},"end":{"line":7,"column":22}}},"2":{"name":"(anonymous_2)","line":15,"loc":{"start":{"line":15,"column":7},"end":{"line":15,"column":27}}},"3":{"name":"(anonymous_3)","line":48,"loc":{"start":{"line":48,"column":6},"end":{"line":48,"column":12}}},"4":{"name":"(anonymous_4)","line":62,"loc":{"start":{"line":62,"column":6},"end":{"line":62,"column":18}}},"5":{"name":"(anonymous_5)","line":70,"loc":{"start":{"line":70,"column":9},"end":{"line":70,"column":15}}},"6":{"name":"(anonymous_6)","line":74,"loc":{"start":{"line":74,"column":13},"end":{"line":74,"column":16}}},"7":{"name":"(anonymous_7)","line":78,"loc":{"start":{"line":78,"column":8},"end":{"line":78,"column":11}}}},"statementMap":{"1":{"start":{"line":2,"column":0},"end":{"line":2,"column":31}},"2":{"start":{"line":3,"column":0},"end":{"line":3,"column":37}},"3":{"start":{"line":4,"column":0},"end":{"line":4,"column":27}},"4":{"start":{"line":8,"column":4},"end":{"line":8,"column":28}},"5":{"start":{"line":9,"column":4},"end":{"line":9,"column":28}},"6":{"start":{"line":11,"column":4},"end":{"line":11,"column":26}},"7":{"start":{"line":12,"column":4},"end":{"line":12,"column":33}},"8":{"start":{"line":16,"column":4},"end":{"line":19,"column":5}},"9":{"start":{"line":17,"column":6},"end":{"line":17,"column":47}},"10":{"start":{"line":18,"column":6},"end":{"line":18,"column":33}},"11":{"start":{"line":20,"column":4},"end":{"line":40,"column":6}},"12":{"start":{"line":26,"column":10},"end":{"line":26,"column":19}},"13":{"start":{"line":27,"column":10},"end":{"line":29,"column":11}},"14":{"start":{"line":28,"column":12},"end":{"line":28,"column":22}},"15":{"start":{"line":30,"column":10},"end":{"line":36,"column":11}},"16":{"start":{"line":31,"column":12},"end":{"line":31,"column":36}},"17":{"start":{"line":33,"column":12},"end":{"line":35,"column":14}},"18":{"start":{"line":37,"column":10},"end":{"line":37,"column":22}},"19":{"start":{"line":42,"column":4},"end":{"line":44,"column":5}},"20":{"start":{"line":43,"column":6},"end":{"line":43,"column":26}},"21":{"start":{"line":45,"column":4},"end":{"line":45,"column":26}},"22":{"start":{"line":49,"column":4},"end":{"line":49,"column":34}},"23":{"start":{"line":63,"column":4},"end":{"line":65,"column":5}},"24":{"start":{"line":64,"column":6},"end":{"line":64,"column":32}},"25":{"start":{"line":67,"column":4},"end":{"line":67,"column":40}},"26":{"start":{"line":71,"column":4},"end":{"line":71,"column":37}},"27":{"start":{"line":75,"column":4},"end":{"line":75,"column":29}},"28":{"start":{"line":79,"column":4},"end":{"line":79,"column":24}},"29":{"start":{"line":83,"column":0},"end":{"line":83,"column":24}}},"branchMap":{"1":{"line":12,"type":"binary-expr","locations":[{"start":{"line":12,"column":14},"end":{"line":12,"column":23}},{"start":{"line":12,"column":27},"end":{"line":12,"column":32}}]},"2":{"line":16,"type":"if","locations":[{"start":{"line":16,"column":4},"end":{"line":16,"column":4}},{"start":{"line":16,"column":4},"end":{"line":16,"column":4}}]},"3":{"line":17,"type":"cond-expr","locations":[{"start":{"line":17,"column":37},"end":{"line":17,"column":40}},{"start":{"line":17,"column":43},"end":{"line":17,"column":46}}]},"4":{"line":27,"type":"if","locations":[{"start":{"line":27,"column":10},"end":{"line":27,"column":10}},{"start":{"line":27,"column":10},"end":{"line":27,"column":10}}]},"5":{"line":42,"type":"if","locations":[{"start":{"line":42,"column":4},"end":{"line":42,"column":4}},{"start":{"line":42,"column":4},"end":{"line":42,"column":4}}]},"6":{"line":63,"type":"if","locations":[{"start":{"line":63,"column":4},"end":{"line":63,"column":4}},{"start":{"line":63,"column":4},"end":{"line":63,"column":4}}]}}},"/Users/emmanuelnyachoke/Code/Mekom/con-tainer2sul/lib/container-to-consul.js":{"path":"/Users/emmanuelnyachoke/Code/Mekom/con-tainer2sul/lib/container-to-consul.js","s":{"1":22,"2":22,"3":22,"4":22,"5":22,"6":22,"7":21,"8":21,"9":21,"10":21,"11":21,"12":25,"13":2,"14":1,"15":1,"16":1,"17":25,"18":2,"19":1,"20":1,"21":1,"22":5,"23":5,"24":2,"25":1,"26":1,"27":4,"28":6,"29":6,"30":1,"31":1,"32":5,"33":4,"34":1,"35":1,"36":3,"37":3,"38":2,"39":2,"40":1,"41":2,"42":4,"43":4,"44":4,"45":2,"46":1,"47":1,"48":1,"49":2,"50":2,"51":2,"52":1,"53":1,"54":1,"55":1,"56":2,"57":2,"58":2,"59":0,"60":0,"61":0,"62":0,"63":0,"64":2,"65":2,"66":1,"67":1,"68":1,"69":1,"70":3,"71":3,"72":3,"73":3,"74":3,"75":3,"76":0,"77":3,"78":3,"79":10,"80":2,"81":2,"82":1,"83":2,"84":2,"85":2,"86":2,"87":1,"88":0,"89":2,"90":1,"91":1,"92":1,"93":2,"94":1,"95":1,"96":1,"97":3,"98":3,"99":3,"100":3,"101":1,"102":3,"103":3,"104":1,"105":3,"106":2,"107":3,"108":3,"109":5,"110":5,"111":1,"112":5,"113":22},"b":{"1":[1,1],"2":[2,1],"3":[1,0],"4":[4,1],"5":[5,4],"6":[1,1],"7":[2,0],"8":[0,0],"9":[3,0],"10":[0,3],"11":[3,3,3],"12":[3,0],"13":[2,2,1,1,1],"14":[1,1],"15":[1,1],"16":[1,2],"17":[3,1],"18":[1,2],"19":[3,2,1],"20":[2,1],"21":[3,2],"22":[1,4],"23":[5,3,1]},"f":{"1":21,"2":25,"3":5,"4":1,"5":4,"6":2,"7":2,"8":3,"9":3,"10":5},"fnMap":{"1":{"name":"(anonymous_1)","line":11,"loc":{"start":{"line":11,"column":13},"end":{"line":11,"column":22}}},"2":{"name":"(anonymous_2)","line":21,"loc":{"start":{"line":21,"column":15},"end":{"line":21,"column":18}}},"3":{"name":"(anonymous_3)","line":42,"loc":{"start":{"line":42,"column":7},"end":{"line":42,"column":10}}},"4":{"name":"(anonymous_4)","line":86,"loc":{"start":{"line":86,"column":20},"end":{"line":86,"column":33}}},"5":{"name":"(anonymous_5)","line":95,"loc":{"start":{"line":95,"column":19},"end":{"line":95,"column":31}}},"6":{"name":"(anonymous_6)","line":128,"loc":{"start":{"line":128,"column":21},"end":{"line":128,"column":33}}},"7":{"name":"(anonymous_7)","line":157,"loc":{"start":{"line":157,"column":19},"end":{"line":157,"column":29}}},"8":{"name":"(anonymous_8)","line":175,"loc":{"start":{"line":175,"column":19},"end":{"line":175,"column":31}}},"9":{"name":"(anonymous_9)","line":247,"loc":{"start":{"line":247,"column":22},"end":{"line":247,"column":34}}},"10":{"name":"(anonymous_10)","line":272,"loc":{"start":{"line":272,"column":18},"end":{"line":272,"column":30}}}},"statementMap":{"1":{"start":{"line":3,"column":0},"end":{"line":3,"column":33}},"2":{"start":{"line":4,"column":0},"end":{"line":4,"column":35}},"3":{"start":{"line":5,"column":0},"end":{"line":5,"column":35}},"4":{"start":{"line":6,"column":0},"end":{"line":6,"column":36}},"5":{"start":{"line":7,"column":0},"end":{"line":7,"column":48}},"6":{"start":{"line":8,"column":0},"end":{"line":8,"column":42}},"7":{"start":{"line":12,"column":4},"end":{"line":12,"column":25}},"8":{"start":{"line":14,"column":4},"end":{"line":14,"column":44}},"9":{"start":{"line":15,"column":4},"end":{"line":15,"column":35}},"10":{"start":{"line":16,"column":4},"end":{"line":16,"column":50}},"11":{"start":{"line":18,"column":4},"end":{"line":18,"column":25}},"12":{"start":{"line":22,"column":4},"end":{"line":30,"column":7}},"13":{"start":{"line":23,"column":6},"end":{"line":29,"column":11}},"14":{"start":{"line":25,"column":27},"end":{"line":25,"column":60}},"15":{"start":{"line":27,"column":10},"end":{"line":27,"column":32}},"16":{"start":{"line":28,"column":10},"end":{"line":28,"column":22}},"17":{"start":{"line":31,"column":4},"end":{"line":39,"column":7}},"18":{"start":{"line":32,"column":6},"end":{"line":38,"column":11}},"19":{"start":{"line":34,"column":27},"end":{"line":34,"column":87}},"20":{"start":{"line":36,"column":10},"end":{"line":36,"column":32}},"21":{"start":{"line":37,"column":10},"end":{"line":37,"column":22}},"22":{"start":{"line":43,"column":4},"end":{"line":78,"column":9}},"23":{"start":{"line":45,"column":18},"end":{"line":51,"column":10}},"24":{"start":{"line":47,"column":10},"end":{"line":49,"column":11}},"25":{"start":{"line":48,"column":12},"end":{"line":48,"column":22}},"26":{"start":{"line":50,"column":10},"end":{"line":50,"column":22}},"27":{"start":{"line":53,"column":8},"end":{"line":71,"column":12}},"28":{"start":{"line":54,"column":10},"end":{"line":70,"column":15}},"29":{"start":{"line":56,"column":14},"end":{"line":69,"column":19}},"30":{"start":{"line":59,"column":18},"end":{"line":61,"column":19}},"31":{"start":{"line":60,"column":20},"end":{"line":60,"column":55}},"32":{"start":{"line":64,"column":18},"end":{"line":66,"column":19}},"33":{"start":{"line":65,"column":20},"end":{"line":65,"column":55}},"34":{"start":{"line":67,"column":18},"end":{"line":67,"column":40}},"35":{"start":{"line":68,"column":18},"end":{"line":68,"column":30}},"36":{"start":{"line":73,"column":18},"end":{"line":73,"column":42}},"37":{"start":{"line":74,"column":26},"end":{"line":74,"column":61}},"38":{"start":{"line":76,"column":8},"end":{"line":76,"column":30}},"39":{"start":{"line":77,"column":8},"end":{"line":77,"column":20}},"40":{"start":{"line":87,"column":4},"end":{"line":87,"column":87}},"41":{"start":{"line":87,"column":51},"end":{"line":87,"column":84}},"42":{"start":{"line":96,"column":4},"end":{"line":96,"column":16}},"43":{"start":{"line":98,"column":4},"end":{"line":108,"column":5}},"44":{"start":{"line":99,"column":6},"end":{"line":99,"column":50}},"45":{"start":{"line":102,"column":6},"end":{"line":105,"column":7}},"46":{"start":{"line":103,"column":8},"end":{"line":103,"column":33}},"47":{"start":{"line":104,"column":8},"end":{"line":104,"column":33}},"48":{"start":{"line":107,"column":6},"end":{"line":107,"column":31}},"49":{"start":{"line":110,"column":4},"end":{"line":110,"column":52}},"50":{"start":{"line":112,"column":4},"end":{"line":119,"column":9}},"51":{"start":{"line":113,"column":18},"end":{"line":113,"column":55}},"52":{"start":{"line":114,"column":18},"end":{"line":114,"column":112}},"53":{"start":{"line":116,"column":8},"end":{"line":116,"column":88}},"54":{"start":{"line":117,"column":8},"end":{"line":117,"column":30}},"55":{"start":{"line":118,"column":8},"end":{"line":118,"column":20}},"56":{"start":{"line":129,"column":4},"end":{"line":132,"column":57}},"57":{"start":{"line":134,"column":4},"end":{"line":136,"column":5}},"58":{"start":{"line":135,"column":6},"end":{"line":135,"column":31}},"59":{"start":{"line":138,"column":4},"end":{"line":146,"column":7}},"60":{"start":{"line":139,"column":6},"end":{"line":145,"column":7}},"61":{"start":{"line":140,"column":8},"end":{"line":142,"column":28}},"62":{"start":{"line":144,"column":8},"end":{"line":144,"column":81}},"63":{"start":{"line":148,"column":4},"end":{"line":148,"column":33}},"64":{"start":{"line":158,"column":4},"end":{"line":158,"column":54}},"65":{"start":{"line":160,"column":4},"end":{"line":166,"column":9}},"66":{"start":{"line":161,"column":18},"end":{"line":161,"column":72}},"67":{"start":{"line":162,"column":18},"end":{"line":162,"column":68}},"68":{"start":{"line":164,"column":8},"end":{"line":164,"column":30}},"69":{"start":{"line":165,"column":8},"end":{"line":165,"column":20}},"70":{"start":{"line":176,"column":4},"end":{"line":185,"column":6}},"71":{"start":{"line":186,"column":4},"end":{"line":189,"column":17}},"72":{"start":{"line":191,"column":4},"end":{"line":193,"column":5}},"73":{"start":{"line":192,"column":6},"end":{"line":192,"column":43}},"74":{"start":{"line":195,"column":4},"end":{"line":195,"column":50}},"75":{"start":{"line":197,"column":4},"end":{"line":199,"column":5}},"76":{"start":{"line":198,"column":6},"end":{"line":198,"column":87}},"77":{"start":{"line":200,"column":4},"end":{"line":234,"column":5}},"78":{"start":{"line":201,"column":6},"end":{"line":233,"column":9}},"79":{"start":{"line":202,"column":8},"end":{"line":232,"column":9}},"80":{"start":{"line":204,"column":12},"end":{"line":204,"column":42}},"81":{"start":{"line":205,"column":12},"end":{"line":207,"column":13}},"82":{"start":{"line":206,"column":14},"end":{"line":206,"column":52}},"83":{"start":{"line":208,"column":12},"end":{"line":208,"column":18}},"84":{"start":{"line":210,"column":12},"end":{"line":219,"column":13}},"85":{"start":{"line":211,"column":14},"end":{"line":211,"column":59}},"86":{"start":{"line":212,"column":14},"end":{"line":214,"column":15}},"87":{"start":{"line":213,"column":16},"end":{"line":213,"column":44}},"88":{"start":{"line":218,"column":14},"end":{"line":218,"column":32}},"89":{"start":{"line":220,"column":12},"end":{"line":220,"column":18}},"90":{"start":{"line":222,"column":12},"end":{"line":222,"column":50}},"91":{"start":{"line":223,"column":12},"end":{"line":223,"column":18}},"92":{"start":{"line":225,"column":12},"end":{"line":227,"column":38}},"93":{"start":{"line":227,"column":26},"end":{"line":227,"column":36}},"94":{"start":{"line":228,"column":12},"end":{"line":228,"column":18}},"95":{"start":{"line":230,"column":12},"end":{"line":230,"column":54}},"96":{"start":{"line":231,"column":12},"end":{"line":231,"column":18}},"97":{"start":{"line":236,"column":4},"end":{"line":236,"column":39}},"98":{"start":{"line":238,"column":4},"end":{"line":238,"column":19}},"99":{"start":{"line":248,"column":4},"end":{"line":248,"column":30}},"100":{"start":{"line":250,"column":4},"end":{"line":252,"column":5}},"101":{"start":{"line":251,"column":6},"end":{"line":251,"column":32}},"102":{"start":{"line":254,"column":4},"end":{"line":254,"column":32}},"103":{"start":{"line":255,"column":4},"end":{"line":257,"column":5}},"104":{"start":{"line":256,"column":6},"end":{"line":256,"column":37}},"105":{"start":{"line":258,"column":4},"end":{"line":260,"column":5}},"106":{"start":{"line":259,"column":6},"end":{"line":259,"column":33}},"107":{"start":{"line":261,"column":4},"end":{"line":261,"column":35}},"108":{"start":{"line":263,"column":4},"end":{"line":263,"column":16}},"109":{"start":{"line":273,"column":4},"end":{"line":273,"column":32}},"110":{"start":{"line":274,"column":4},"end":{"line":276,"column":5}},"111":{"start":{"line":275,"column":6},"end":{"line":275,"column":37}},"112":{"start":{"line":277,"column":4},"end":{"line":277,"column":16}},"113":{"start":{"line":282,"column":0},"end":{"line":282,"column":35}}},"branchMap":{"1":{"line":47,"type":"if","locations":[{"start":{"line":47,"column":10},"end":{"line":47,"column":10}},{"start":{"line":47,"column":10},"end":{"line":47,"column":10}}]},"2":{"line":47,"type":"binary-expr","locations":[{"start":{"line":47,"column":14},"end":{"line":47,"column":30}},{"start":{"line":47,"column":34},"end":{"line":47,"column":58}}]},"3":{"line":59,"type":"if","locations":[{"start":{"line":59,"column":18},"end":{"line":59,"column":18}},{"start":{"line":59,"column":18},"end":{"line":59,"column":18}}]},"4":{"line":64,"type":"if","locations":[{"start":{"line":64,"column":18},"end":{"line":64,"column":18}},{"start":{"line":64,"column":18},"end":{"line":64,"column":18}}]},"5":{"line":64,"type":"binary-expr","locations":[{"start":{"line":64,"column":22},"end":{"line":64,"column":38}},{"start":{"line":64,"column":42},"end":{"line":64,"column":66}}]},"6":{"line":102,"type":"if","locations":[{"start":{"line":102,"column":6},"end":{"line":102,"column":6}},{"start":{"line":102,"column":6},"end":{"line":102,"column":6}}]},"7":{"line":134,"type":"if","locations":[{"start":{"line":134,"column":4},"end":{"line":134,"column":4}},{"start":{"line":134,"column":4},"end":{"line":134,"column":4}}]},"8":{"line":139,"type":"if","locations":[{"start":{"line":139,"column":6},"end":{"line":139,"column":6}},{"start":{"line":139,"column":6},"end":{"line":139,"column":6}}]},"9":{"line":191,"type":"if","locations":[{"start":{"line":191,"column":4},"end":{"line":191,"column":4}},{"start":{"line":191,"column":4},"end":{"line":191,"column":4}}]},"10":{"line":197,"type":"if","locations":[{"start":{"line":197,"column":4},"end":{"line":197,"column":4}},{"start":{"line":197,"column":4},"end":{"line":197,"column":4}}]},"11":{"line":197,"type":"binary-expr","locations":[{"start":{"line":197,"column":8},"end":{"line":197,"column":38}},{"start":{"line":197,"column":42},"end":{"line":197,"column":77}},{"start":{"line":197,"column":81},"end":{"line":197,"column":105}}]},"12":{"line":200,"type":"if","locations":[{"start":{"line":200,"column":4},"end":{"line":200,"column":4}},{"start":{"line":200,"column":4},"end":{"line":200,"column":4}}]},"13":{"line":202,"type":"switch","locations":[{"start":{"line":203,"column":10},"end":{"line":208,"column":18}},{"start":{"line":209,"column":10},"end":{"line":220,"column":18}},{"start":{"line":221,"column":10},"end":{"line":223,"column":18}},{"start":{"line":224,"column":10},"end":{"line":228,"column":18}},{"start":{"line":229,"column":10},"end":{"line":231,"column":18}}]},"14":{"line":205,"type":"if","locations":[{"start":{"line":205,"column":12},"end":{"line":205,"column":12}},{"start":{"line":205,"column":12},"end":{"line":205,"column":12}}]},"15":{"line":212,"type":"if","locations":[{"start":{"line":212,"column":14},"end":{"line":212,"column":14}},{"start":{"line":212,"column":14},"end":{"line":212,"column":14}}]},"16":{"line":250,"type":"if","locations":[{"start":{"line":250,"column":4},"end":{"line":250,"column":4}},{"start":{"line":250,"column":4},"end":{"line":250,"column":4}}]},"17":{"line":250,"type":"binary-expr","locations":[{"start":{"line":250,"column":8},"end":{"line":250,"column":13}},{"start":{"line":250,"column":17},"end":{"line":250,"column":32}}]},"18":{"line":255,"type":"if","locations":[{"start":{"line":255,"column":4},"end":{"line":255,"column":4}},{"start":{"line":255,"column":4},"end":{"line":255,"column":4}}]},"19":{"line":255,"type":"binary-expr","locations":[{"start":{"line":255,"column":8},"end":{"line":255,"column":13}},{"start":{"line":255,"column":17},"end":{"line":255,"column":33}},{"start":{"line":255,"column":37},"end":{"line":255,"column":60}}]},"20":{"line":258,"type":"if","locations":[{"start":{"line":258,"column":4},"end":{"line":258,"column":4}},{"start":{"line":258,"column":4},"end":{"line":258,"column":4}}]},"21":{"line":258,"type":"binary-expr","locations":[{"start":{"line":258,"column":8},"end":{"line":258,"column":12}},{"start":{"line":258,"column":16},"end":{"line":258,"column":35}}]},"22":{"line":274,"type":"if","locations":[{"start":{"line":274,"column":4},"end":{"line":274,"column":4}},{"start":{"line":274,"column":4},"end":{"line":274,"column":4}}]},"23":{"line":274,"type":"binary-expr","locations":[{"start":{"line":274,"column":8},"end":{"line":274,"column":13}},{"start":{"line":274,"column":17},"end":{"line":274,"column":33}},{"start":{"line":274,"column":37},"end":{"line":274,"column":60}}]}}},"/Users/emmanuelnyachoke/Code/Mekom/con-tainer2sul/lib/parse-key-pair.js":{"path":"/Users/emmanuelnyachoke/Code/Mekom/con-tainer2sul/lib/parse-key-pair.js","s":{"1":1,"2":1,"3":1,"4":1,"5":1,"6":1,"7":1,"8":0,"9":1,"10":0,"11":1,"12":0,"13":1,"14":0,"15":1,"16":0,"17":1,"18":0,"19":1,"20":1,"21":0,"22":1,"23":1,"24":1},"b":{"1":[1,0],"2":[1,1],"3":[1,0],"4":[0,1],"5":[0,1],"6":[0,1],"7":[0,1],"8":[0,1],"9":[1,0],"10":[0,1]},"f":{"1":1,"2":1},"fnMap":{"1":{"name":"parser","line":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}},"2":{"name":"(anonymous_2)","line":29,"loc":{"start":{"line":29,"column":17},"end":{"line":29,"column":43}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":27,"column":1}},"2":{"start":{"line":3,"column":2},"end":{"line":3,"column":161}},"3":{"start":{"line":4,"column":2},"end":{"line":26,"column":3}},"4":{"start":{"line":5,"column":4},"end":{"line":5,"column":71}},"5":{"start":{"line":6,"column":4},"end":{"line":22,"column":5}},"6":{"start":{"line":7,"column":6},"end":{"line":7,"column":76}},"7":{"start":{"line":9,"column":6},"end":{"line":19,"column":7}},"8":{"start":{"line":10,"column":8},"end":{"line":10,"column":39}},"9":{"start":{"line":11,"column":13},"end":{"line":19,"column":7}},"10":{"start":{"line":12,"column":8},"end":{"line":12,"column":33}},"11":{"start":{"line":13,"column":13},"end":{"line":19,"column":7}},"12":{"start":{"line":14,"column":8},"end":{"line":14,"column":28}},"13":{"start":{"line":15,"column":13},"end":{"line":19,"column":7}},"14":{"start":{"line":16,"column":8},"end":{"line":16,"column":29}},"15":{"start":{"line":18,"column":8},"end":{"line":18,"column":27}},"16":{"start":{"line":21,"column":6},"end":{"line":21,"column":44}},"17":{"start":{"line":23,"column":4},"end":{"line":25,"column":5}},"18":{"start":{"line":24,"column":6},"end":{"line":24,"column":33}},"19":{"start":{"line":29,"column":0},"end":{"line":38,"column":2}},"20":{"start":{"line":31,"column":2},"end":{"line":37,"column":3}},"21":{"start":{"line":32,"column":4},"end":{"line":32,"column":27}},"22":{"start":{"line":34,"column":4},"end":{"line":34,"column":16}},"23":{"start":{"line":35,"column":4},"end":{"line":35,"column":27}},"24":{"start":{"line":36,"column":4},"end":{"line":36,"column":18}}},"branchMap":{"1":{"line":4,"type":"if","locations":[{"start":{"line":4,"column":2},"end":{"line":4,"column":2}},{"start":{"line":4,"column":2},"end":{"line":4,"column":2}}]},"2":{"line":4,"type":"binary-expr","locations":[{"start":{"line":4,"column":6},"end":{"line":4,"column":12}},{"start":{"line":4,"column":16},"end":{"line":4,"column":25}}]},"3":{"line":6,"type":"if","locations":[{"start":{"line":6,"column":4},"end":{"line":6,"column":4}},{"start":{"line":6,"column":4},"end":{"line":6,"column":4}}]},"4":{"line":9,"type":"if","locations":[{"start":{"line":9,"column":6},"end":{"line":9,"column":6}},{"start":{"line":9,"column":6},"end":{"line":9,"column":6}}]},"5":{"line":11,"type":"if","locations":[{"start":{"line":11,"column":13},"end":{"line":11,"column":13}},{"start":{"line":11,"column":13},"end":{"line":11,"column":13}}]},"6":{"line":13,"type":"if","locations":[{"start":{"line":13,"column":13},"end":{"line":13,"column":13}},{"start":{"line":13,"column":13},"end":{"line":13,"column":13}}]},"7":{"line":15,"type":"if","locations":[{"start":{"line":15,"column":13},"end":{"line":15,"column":13}},{"start":{"line":15,"column":13},"end":{"line":15,"column":13}}]},"8":{"line":23,"type":"if","locations":[{"start":{"line":23,"column":4},"end":{"line":23,"column":4}},{"start":{"line":23,"column":4},"end":{"line":23,"column":4}}]},"9":{"line":23,"type":"binary-expr","locations":[{"start":{"line":23,"column":8},"end":{"line":23,"column":17}},{"start":{"line":23,"column":21},"end":{"line":23,"column":41}}]},"10":{"line":31,"type":"if","locations":[{"start":{"line":31,"column":2},"end":{"line":31,"column":2}},{"start":{"line":31,"column":2},"end":{"line":31,"column":2}}]}}},"/Users/emmanuelnyachoke/Code/Mekom/con-tainer2sul/lib/docker.js":{"path":"/Users/emmanuelnyachoke/Code/Mekom/con-tainer2sul/lib/docker.js","s":{"1":7,"2":7,"3":7,"4":7,"5":6,"6":6,"7":6,"8":6,"9":6,"10":6,"11":6,"12":5,"13":4,"14":4,"15":4,"16":4,"17":4,"18":5,"19":1,"20":1,"21":2,"22":1,"23":1,"24":1,"25":1,"26":7},"b":{"1":[1,1]},"f":{"1":6,"2":6,"3":1},"fnMap":{"1":{"name":"(anonymous_1)","line":9,"loc":{"start":{"line":9,"column":14},"end":{"line":9,"column":34}}},"2":{"name":"(anonymous_2)","line":20,"loc":{"start":{"line":20,"column":8},"end":{"line":20,"column":11}}},"3":{"name":"(anonymous_3)","line":50,"loc":{"start":{"line":50,"column":13},"end":{"line":50,"column":16}}}},"statementMap":{"1":{"start":{"line":3,"column":0},"end":{"line":3,"column":39}},"2":{"start":{"line":4,"column":0},"end":{"line":4,"column":54}},"3":{"start":{"line":5,"column":0},"end":{"line":5,"column":46}},"4":{"start":{"line":6,"column":0},"end":{"line":6,"column":36}},"5":{"start":{"line":10,"column":4},"end":{"line":10,"column":47}},"6":{"start":{"line":12,"column":4},"end":{"line":12,"column":50}},"7":{"start":{"line":13,"column":4},"end":{"line":13,"column":52}},"8":{"start":{"line":14,"column":4},"end":{"line":14,"column":32}},"9":{"start":{"line":15,"column":4},"end":{"line":17,"column":7}},"10":{"start":{"line":21,"column":4},"end":{"line":47,"column":9}},"11":{"start":{"line":22,"column":6},"end":{"line":22,"column":26}},"12":{"start":{"line":24,"column":6},"end":{"line":32,"column":9}},"13":{"start":{"line":25,"column":8},"end":{"line":25,"column":63}},"14":{"start":{"line":27,"column":8},"end":{"line":31,"column":13}},"15":{"start":{"line":29,"column":12},"end":{"line":29,"column":99}},"16":{"start":{"line":29,"column":50},"end":{"line":29,"column":71}},"17":{"start":{"line":30,"column":12},"end":{"line":30,"column":22}},"18":{"start":{"line":34,"column":6},"end":{"line":37,"column":9}},"19":{"start":{"line":35,"column":8},"end":{"line":35,"column":82}},"20":{"start":{"line":36,"column":8},"end":{"line":36,"column":28}},"21":{"start":{"line":41,"column":8},"end":{"line":43,"column":9}},"22":{"start":{"line":42,"column":10},"end":{"line":42,"column":30}},"23":{"start":{"line":45,"column":8},"end":{"line":45,"column":48}},"24":{"start":{"line":46,"column":8},"end":{"line":46,"column":37}},"25":{"start":{"line":51,"column":4},"end":{"line":51,"column":40}},"26":{"start":{"line":55,"column":0},"end":{"line":55,"column":24}}},"branchMap":{"1":{"line":41,"type":"if","locations":[{"start":{"line":41,"column":8},"end":{"line":41,"column":8}},{"start":{"line":41,"column":8},"end":{"line":41,"column":8}}]}}},"/Users/emmanuelnyachoke/Code/Mekom/con-tainer2sul/lib/typedefs.js":{"path":"/Users/emmanuelnyachoke/Code/Mekom/con-tainer2sul/lib/typedefs.js","s":{},"b":{},"f":{},"fnMap":{},"statementMap":{},"branchMap":{}}}
\ No newline at end of file
diff --git a/coverage/lcov-report/base.css b/coverage/lcov-report/base.css
deleted file mode 100644
index 29737bc..0000000
--- a/coverage/lcov-report/base.css
+++ /dev/null
@@ -1,213 +0,0 @@
-body, html {
- margin:0; padding: 0;
- height: 100%;
-}
-body {
- font-family: Helvetica Neue, Helvetica, Arial;
- font-size: 14px;
- color:#333;
-}
-.small { font-size: 12px; }
-*, *:after, *:before {
- -webkit-box-sizing:border-box;
- -moz-box-sizing:border-box;
- box-sizing:border-box;
- }
-h1 { font-size: 20px; margin: 0;}
-h2 { font-size: 14px; }
-pre {
- font: 12px/1.4 Consolas, "Liberation Mono", Menlo, Courier, monospace;
- margin: 0;
- padding: 0;
- -moz-tab-size: 2;
- -o-tab-size: 2;
- tab-size: 2;
-}
-a { color:#0074D9; text-decoration:none; }
-a:hover { text-decoration:underline; }
-.strong { font-weight: bold; }
-.space-top1 { padding: 10px 0 0 0; }
-.pad2y { padding: 20px 0; }
-.pad1y { padding: 10px 0; }
-.pad2x { padding: 0 20px; }
-.pad2 { padding: 20px; }
-.pad1 { padding: 10px; }
-.space-left2 { padding-left:55px; }
-.space-right2 { padding-right:20px; }
-.center { text-align:center; }
-.clearfix { display:block; }
-.clearfix:after {
- content:'';
- display:block;
- height:0;
- clear:both;
- visibility:hidden;
- }
-.fl { float: left; }
-@media only screen and (max-width:640px) {
- .col3 { width:100%; max-width:100%; }
- .hide-mobile { display:none!important; }
-}
-
-.quiet {
- color: #7f7f7f;
- color: rgba(0,0,0,0.5);
-}
-.quiet a { opacity: 0.7; }
-
-.fraction {
- font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace;
- font-size: 10px;
- color: #555;
- background: #E8E8E8;
- padding: 4px 5px;
- border-radius: 3px;
- vertical-align: middle;
-}
-
-div.path a:link, div.path a:visited { color: #333; }
-table.coverage {
- border-collapse: collapse;
- margin: 10px 0 0 0;
- padding: 0;
-}
-
-table.coverage td {
- margin: 0;
- padding: 0;
- vertical-align: top;
-}
-table.coverage td.line-count {
- text-align: right;
- padding: 0 5px 0 20px;
-}
-table.coverage td.line-coverage {
- text-align: right;
- padding-right: 10px;
- min-width:20px;
-}
-
-table.coverage td span.cline-any {
- display: inline-block;
- padding: 0 5px;
- width: 100%;
-}
-.missing-if-branch {
- display: inline-block;
- margin-right: 5px;
- border-radius: 3px;
- position: relative;
- padding: 0 4px;
- background: #333;
- color: yellow;
-}
-
-.skip-if-branch {
- display: none;
- margin-right: 10px;
- position: relative;
- padding: 0 4px;
- background: #ccc;
- color: white;
-}
-.missing-if-branch .typ, .skip-if-branch .typ {
- color: inherit !important;
-}
-.coverage-summary {
- border-collapse: collapse;
- width: 100%;
-}
-.coverage-summary tr { border-bottom: 1px solid #bbb; }
-.keyline-all { border: 1px solid #ddd; }
-.coverage-summary td, .coverage-summary th { padding: 10px; }
-.coverage-summary tbody { border: 1px solid #bbb; }
-.coverage-summary td { border-right: 1px solid #bbb; }
-.coverage-summary td:last-child { border-right: none; }
-.coverage-summary th {
- text-align: left;
- font-weight: normal;
- white-space: nowrap;
-}
-.coverage-summary th.file { border-right: none !important; }
-.coverage-summary th.pct { }
-.coverage-summary th.pic,
-.coverage-summary th.abs,
-.coverage-summary td.pct,
-.coverage-summary td.abs { text-align: right; }
-.coverage-summary td.file { white-space: nowrap; }
-.coverage-summary td.pic { min-width: 120px !important; }
-.coverage-summary tfoot td { }
-
-.coverage-summary .sorter {
- height: 10px;
- width: 7px;
- display: inline-block;
- margin-left: 0.5em;
- background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent;
-}
-.coverage-summary .sorted .sorter {
- background-position: 0 -20px;
-}
-.coverage-summary .sorted-desc .sorter {
- background-position: 0 -10px;
-}
-.status-line { height: 10px; }
-/* dark red */
-.red.solid, .status-line.low, .low .cover-fill { background:#C21F39 }
-.low .chart { border:1px solid #C21F39 }
-/* medium red */
-.cstat-no, .fstat-no, .cbranch-no, .cbranch-no { background:#F6C6CE }
-/* light red */
-.low, .cline-no { background:#FCE1E5 }
-/* light green */
-.high, .cline-yes { background:rgb(230,245,208) }
-/* medium green */
-.cstat-yes { background:rgb(161,215,106) }
-/* dark green */
-.status-line.high, .high .cover-fill { background:rgb(77,146,33) }
-.high .chart { border:1px solid rgb(77,146,33) }
-/* dark yellow (gold) */
-.medium .chart { border:1px solid #f9cd0b; }
-.status-line.medium, .medium .cover-fill { background: #f9cd0b; }
-/* light yellow */
-.medium { background: #fff4c2; }
-/* light gray */
-span.cline-neutral { background: #eaeaea; }
-
-.cbranch-no { background: yellow !important; color: #111; }
-
-.cstat-skip { background: #ddd; color: #111; }
-.fstat-skip { background: #ddd; color: #111 !important; }
-.cbranch-skip { background: #ddd !important; color: #111; }
-
-
-.cover-fill, .cover-empty {
- display:inline-block;
- height: 12px;
-}
-.chart {
- line-height: 0;
-}
-.cover-empty {
- background: white;
-}
-.cover-full {
- border-right: none !important;
-}
-pre.prettyprint {
- border: none !important;
- padding: 0 !important;
- margin: 0 !important;
-}
-.com { color: #999 !important; }
-.ignore-none { color: #999; font-weight: normal; }
-
-.wrapper {
- min-height: 100%;
- height: auto !important;
- height: 100%;
- margin: 0 auto -48px;
-}
-.footer, .push {
- height: 48px;
-}
diff --git a/coverage/lcov-report/index.html b/coverage/lcov-report/index.html
deleted file mode 100644
index ad84d9f..0000000
--- a/coverage/lcov-report/index.html
+++ /dev/null
@@ -1,119 +0,0 @@
-
-
-
- Code coverage report for All files
-
-
-
-
-
-
-
-
-
-
- /
-
-
-
- 89.37%
- Statements
- 185/207
-
-
- 77.27%
- Branches
- 68/88
-
-
- 100%
- Functions
- 31/31
-
-
- 89.27%
- Lines
- 183/205
-
-
-
-
-
-
-
-
- File |
- |
- Statements |
- |
- Branches |
- |
- Functions |
- |
- Lines |
- |
-
-
-
- lib/ |
- |
- 91.41% |
- 149/163 |
- 78.38% |
- 58/74 |
- 100% |
- 15/15 |
- 91.3% |
- 147/161 |
-
-
-
- lib/consul/ |
- |
- 80.95% |
- 34/42 |
- 71.43% |
- 10/14 |
- 100% |
- 15/15 |
- 80.95% |
- 34/42 |
-
-
-
- lib/errors/ |
- |
- 100% |
- 2/2 |
- 100% |
- 0/0 |
- 100% |
- 1/1 |
- 100% |
- 2/2 |
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/coverage/lcov-report/lib/con-tainer2sul.js.html b/coverage/lcov-report/lib/con-tainer2sul.js.html
deleted file mode 100644
index 4886df6..0000000
--- a/coverage/lcov-report/lib/con-tainer2sul.js.html
+++ /dev/null
@@ -1,896 +0,0 @@
-
-
-
- Code coverage report for lib/con-tainer2sul.js
-
-
-
-
-
-
-
-
-
-
-
-
- 94.5%
- Statements
- 103/109
-
-
- 86.27%
- Branches
- 44/51
-
-
- 100%
- Functions
- 10/10
-
-
- 94.44%
- Lines
- 102/108
-
-
-
-
-
-1
-2
-3
-4
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
-26
-27
-28
-29
-30
-31
-32
-33
-34
-35
-36
-37
-38
-39
-40
-41
-42
-43
-44
-45
-46
-47
-48
-49
-50
-51
-52
-53
-54
-55
-56
-57
-58
-59
-60
-61
-62
-63
-64
-65
-66
-67
-68
-69
-70
-71
-72
-73
-74
-75
-76
-77
-78
-79
-80
-81
-82
-83
-84
-85
-86
-87
-88
-89
-90
-91
-92
-93
-94
-95
-96
-97
-98
-99
-100
-101
-102
-103
-104
-105
-106
-107
-108
-109
-110
-111
-112
-113
-114
-115
-116
-117
-118
-119
-120
-121
-122
-123
-124
-125
-126
-127
-128
-129
-130
-131
-132
-133
-134
-135
-136
-137
-138
-139
-140
-141
-142
-143
-144
-145
-146
-147
-148
-149
-150
-151
-152
-153
-154
-155
-156
-157
-158
-159
-160
-161
-162
-163
-164
-165
-166
-167
-168
-169
-170
-171
-172
-173
-174
-175
-176
-177
-178
-179
-180
-181
-182
-183
-184
-185
-186
-187
-188
-189
-190
-191
-192
-193
-194
-195
-196
-197
-198
-199
-200
-201
-202
-203
-204
-205
-206
-207
-208
-209
-210
-211
-212
-213
-214
-215
-216
-217
-218
-219
-220
-221
-222
-223
-224
-225
-226
-227
-228
-229
-230
-231
-232
-233
-234
-235
-236
-237
-238
-239
-240
-241
-242
-243
-244
-245
-246
-247
-248
-249
-250
-251
-252
-253
-254
-255
-256
-257
-258
-259
-260
-261
-262
-263
-264
-265
-266
-267
-268
-269
-270
-271
-272
-273
-274
-275
-276
-277
-278 |
-
-22×
-22×
-22×
-22×
-22×
-
-
-
-21×
-
-21×
-21×
-21×
-
-21×
-
-
-
-25×
-2×
-
-1×
-
-1×
-1×
-
-
-25×
-2×
-
-1×
-
-1×
-1×
-
-
-
-
-
-5×
-
-5×
-
-2×
-1×
-
-1×
-
-
-4×
-6×
-
-6×
-
-
-1×
-1×
-
-
-
-5×
-4×
-
-1×
-1×
-
-
-
-
-
-3×
-3×
-
-2×
-2×
-
-
-
-
-
-
-
-
-
-2×
-
-
-
-
-
-
-
-
-4×
-
-4×
-4×
-
-
-2×
-1×
-1×
-
-
-1×
-
-
-2×
-
-2×
-2×
-1×
-
-1×
-1×
-1×
-
-
-
-
-
-
-
-
-
-
-2×
-
-
-
-
-2×
-2×
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-2×
-
-2×
-1×
-1×
-
-1×
-1×
-
-
-
-
-
-
-
-
-
-
-3×
-
-
-
-
-
-
-3×
-
-
-
-
-3×
-3×
-
-
-3×
-
-3×
-
-
-3×
-3×
-9×
-
-2×
-2×
-1×
-
-2×
-
-2×
-2×
-2×
-1×
-
-
-
-
-
-2×
-
-1×
-1×
-
-1×
-
-2×
-1×
-
-
-
-
-3×
-
-3×
-
-
-
-
-
-
-
-
-
-3×
-
-3×
-1×
-
-
-3×
-3×
-1×
-
-3×
-2×
-
-3×
-
-3×
-
-
-
-
-
-
-
-
-
-5×
-5×
-1×
-
-5×
-
-
-
-
-
-
-22×
- | 'use strict';
-
-const bunyan = require('bunyan');
-const Consul = require('./consul');
-const Docker = require('./docker');
-const Promise = require('bluebird');
-const SkipError = require('./errors/skipError');
-
-class ConTainer2Sul {
- constructor(config) {
- this.config = config;
-
- this.consul = new Consul(config.consul);
- this.docker = new Docker(this);
- this.log = bunyan.createLogger(config.logger);
-
- this._attachEvents();
- }
-
- _attachEvents() {
- this.docker.events.on('start', msg => {
- return this.docker.client.getContainer(msg.id)
- .inspect()
- .then(container => this.registerContainer(container))
- .catch(error => {
- this.log.error(error);
- throw error;
- });
- });
- this.docker.events.on('die', msg => {
- return this.docker.client.getContainer(msg.id)
- .inspect()
- .then(container => this.deregisterService(this.containerServiceName(container)))
- .catch(error => {
- this.log.error(error);
- throw error;
- });
- });
- }
-
- start() {
- return this.docker.start()
- // deregister containers that do not run
- .then(() => this.consul.kv.keys('docker/service-ids/')
- .catch(error => {
- if (error.statusCode && error.statusCode === 404) {
- return [];
- }
- throw error;
- }))
- .then(keys => {
- return Promise.all(keys.map(key => {
- return this.consul.kv.get(key)
- .then(containerId => {
- return this.docker.client.getContainer(containerId)
- .inspect()
- .then(container => {
- Eif (container.State.Status !== 'running') {
- return this.deregisterService(key);
- }
- })
- .catch(error => {
- if (error.statusCode && error.statusCode === 404) {
- return this.deregisterService(key);
- }
- this.log.error(error);
- throw error;
- });
- });
- }));
- })
- // register all containers
- .then(() => this.docker.containers())
- .then(containers => this.registerContainers(containers))
- .catch(error => {
- this.log.error(error);
- throw error;
- });
- }
-
- /**
- *
- * @param {Container[]} containers
- * @returns {Promise.<*>}
- */
- registerContainers(containers) {
- return Promise.all(containers.map(container => this.registerContainer(container)));
- }
-
- /**
- *
- * @param {Container} container
- * @returns {Promise}
- */
- registerContainer(container) {
- let service;
-
- try {
- service = this.container2Service(container);
- }
- catch (e) {
- if (e instanceof SkipError) {
- this.log.info(e.message);
- return Promise.resolve();
- }
-
- return Promise.reject(e);
- }
-
- this.log.info('registering container', service);
-
- return this.registerContainerKv(container)
- .then(() => this.consul.catalog.register(service))
- .then(() => this.consul.kv.set(`docker/service-ids/${this.containerServiceName(container)}`, container.Id))
- .catch(error => {
- this.consul.kv.delete(`services/${this.containerServiceName(container)}`, true);
- this.log.error(error);
- throw error;
- });
- }
-
- /**
- * Registers key/value pairs for the container
- *
- * @param {Container} container
- * @returns {Promise}
- */
- registerContainerKv(container) {
- const
- lbls = this._containerLabels(container),
- promises = [],
- serviceName = this.containerServiceName(container);
-
- Eif (!lbls) {
- return Promise.resolve();
- }
-
- Object.keys(lbls).forEach(label => {
- if (label.startsWith('consul.kv.')) {
- const
- key = label.replace(/^consul\.kv\./, ''),
- val = lbls[label];
-
- promises.push(this.consul.kv.set(`services/${serviceName}/${key}`, val));
- }
- });
-
- return Promise.all(promises);
- }
-
- /**
- * Un-register a service and related information from Consul
- *
- * @param {string} service
- * @returns {Promise}
- */
- deregisterService(service) {
- this.log.info('deregistering container', service);
-
- return this.consul.catalog.deregister({ Node: service })
- .then(() => this.consul.kv.delete(`docker/service-ids/${service}`))
- .then(() => this.consul.kv.delete(`services/${service}`, true))
- .catch(error => {
- this.log.error(error);
- throw error;
- });
- }
-
- /**
- * Given a container, returns a service definition ready to be consumed by Consul catalog/register API endpoint
- *
- * @param container
- * @returns {Object}
- */
- container2Service(container) {
- let service = {
- Node: this.containerServiceName(container),
- Address: this.docker.docker0,
- Service: {
- Service: this.containerServiceName(container)
- }
- };
- let containerIPAddress = container
- .NetworkSettings
- .Networks[Object.keys(container.NetworkSettings.Networks)[0]]
- .IPAddress;
-
- Eif (containerIPAddress !== '') {
- service.Address = containerIPAddress;
- }
-
- const lbls = this._containerLabels(container);
-
- Iif (Object.keys(lbls).length === 0 || lbls['consul.register'] === 'false' || !lbls['consul.register']) {
- throw new SkipError(`Container ${this.containerServiceName(container)} skipped`);
- }
- Eif (lbls) {
- Object.keys(lbls).forEach(label => {
- switch (label) {
- case 'consul.ip':
- service.Address = lbls[label];
- if (service.Address === 'host') {
- service.Address = this.docker.docker0;
- }
- break;
- case 'consul.port':
- try {
- service.Service.Port = parseInt(lbls[label]);
- if (isNaN(service.Service.Port)) {
- delete service.Service.Port;
- }
- }
- catch (e) {
- // do nothing
- }
- break;
- case 'consul.service':
- service.Service.Service = lbls[label];
- break;
- case 'consul.tags':
- service.Service.Tags = lbls[label]
- .split(',')
- .map(tag => tag.trim());
- break;
- }
- });
- }
-
- this.log.debug('service', service);
-
- return service;
- }
-
- /**
- * Returns the service name for the container
- *
- * @param {Container} container
- * @returns {string}
- */
- containerServiceName(container) {
- let name = container.Name;
-
- if (!name && container.Names) {
- name = container.Names[0];
- }
-
- let lbls = container.Labels;
- if (!lbls && container.Config && container.Config.Labels) {
- lbls = container.Config.Labels;
- }
- if (lbls && lbls['consul.name']) {
- name = lbls['consul.name'];
- }
- name = name.replace(/^\//, '');
-
- return name;
- }
-
- /**
- *
- * @param container
- * @returns {Object}
- * @private
- */
- _containerLabels(container) {
- let lbls = container.Labels;
- if (!lbls && container.Config && container.Config.Labels) {
- lbls = container.Config.Labels;
- }
- return lbls;
- }
-
-}
-
-
-
-module.exports = ConTainer2Sul;
- |
-
-
-
-
-
-
-
-
-
-
diff --git a/coverage/lcov-report/lib/consul/axios-instance.js.html b/coverage/lcov-report/lib/consul/axios-instance.js.html
deleted file mode 100644
index e5a9f0c..0000000
--- a/coverage/lcov-report/lib/consul/axios-instance.js.html
+++ /dev/null
@@ -1,80 +0,0 @@
-
-
-
- Code coverage report for lib/consul/axios-instance.js
-
-
-
-
-
-
-
-
-
-
-
-
- 0%
- Statements
- 0/3
-
-
- 100%
- Branches
- 0/0
-
-
- 0%
- Functions
- 0/1
-
-
- 0%
- Lines
- 0/3
-
-
-
-
-
-1
-2
-3
-4
-5
-6 |
-
-
-
-
- | const axios = require('axios');
-module.exports = axios.create({
- transformResponse: [function transformResponse(data) {
- return JSON.parse(data);
- }]
-}); |
-
-
-
-
-
-
-
-
-
-
diff --git a/coverage/lcov-report/lib/consul/catalog.js.html b/coverage/lcov-report/lib/consul/catalog.js.html
deleted file mode 100644
index 95de3f9..0000000
--- a/coverage/lcov-report/lib/consul/catalog.js.html
+++ /dev/null
@@ -1,113 +0,0 @@
-
-
-
- Code coverage report for lib/consul/catalog.js
-
-
-
-
-
-
-
-
-
-
-
-
- 100%
- Statements
- 4/4
-
-
- 100%
- Branches
- 0/0
-
-
- 100%
- Functions
- 3/3
-
-
- 100%
- Lines
- 4/4
-
-
-
-
-
-1
-2
-3
-4
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17 |
-
-
-
-3×
-
-
-
-1×
-
-
-
-1×
-
-
-
-1× | 'use strict';
-
-class Catalog {
- constructor (consul) {
- this.consul = consul;
- }
-
- register (data) {
- return this.consul._put('/v1/catalog/register', data);
- }
-
- deregister (data) {
- return this.consul._put('/v1/catalog/deregister', data);
- }
-}
-
-module.exports = Catalog; |
-
-
-
-
-
-
-
-
-
-
diff --git a/coverage/lcov-report/lib/consul/index.html b/coverage/lcov-report/lib/consul/index.html
deleted file mode 100644
index 50d5b0b..0000000
--- a/coverage/lcov-report/lib/consul/index.html
+++ /dev/null
@@ -1,119 +0,0 @@
-
-
-
- Code coverage report for lib/consul/
-
-
-
-
-
-
-
-
-
-
-
-
- 80.95%
- Statements
- 34/42
-
-
- 71.43%
- Branches
- 10/14
-
-
- 100%
- Functions
- 15/15
-
-
- 80.95%
- Lines
- 34/42
-
-
-
-
-
-
-
-
- File |
- |
- Statements |
- |
- Branches |
- |
- Functions |
- |
- Lines |
- |
-
-
-
- catalog.js |
- |
- 100% |
- 4/4 |
- 100% |
- 0/0 |
- 100% |
- 3/3 |
- 100% |
- 4/4 |
-
-
-
- index.js |
- |
- 75.86% |
- 22/29 |
- 75% |
- 9/12 |
- 100% |
- 7/7 |
- 75.86% |
- 22/29 |
-
-
-
- kv.js |
- |
- 88.89% |
- 8/9 |
- 50% |
- 1/2 |
- 100% |
- 5/5 |
- 88.89% |
- 8/9 |
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/coverage/lcov-report/lib/consul/index.js.html b/coverage/lcov-report/lib/consul/index.js.html
deleted file mode 100644
index 299c307..0000000
--- a/coverage/lcov-report/lib/consul/index.js.html
+++ /dev/null
@@ -1,311 +0,0 @@
-
-
-
- Code coverage report for lib/consul/index.js
-
-
-
-
-
-
-
-
-
-
-
-
- 75.86%
- Statements
- 22/29
-
-
- 75%
- Branches
- 9/12
-
-
- 100%
- Functions
- 7/7
-
-
- 75.86%
- Lines
- 22/29
-
-
-
-
-
-1
-2
-3
-4
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
-26
-27
-28
-29
-30
-31
-32
-33
-34
-35
-36
-37
-38
-39
-40
-41
-42
-43
-44
-45
-46
-47
-48
-49
-50
-51
-52
-53
-54
-55
-56
-57
-58
-59
-60
-61
-62
-63
-64
-65
-66
-67
-68
-69
-70
-71
-72
-73
-74
-75
-76
-77
-78
-79
-80
-81
-82
-83 |
-1×
-1×
-1×
-
-
-
-6×
-6×
-
-6×
-6×
-
-
-
-2×
-2×
-2×
-
-2×
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-2×
-1×
-
-2×
-
-
-
-1×
-
-
-
-
-
-
-
-
-
-
-
-
-
-2×
-1×
-
-
-2×
-
-
-
-1×
-
-
-
-1×
-
-
-
-1×
-
-
-
-1× | 'use strict';
-const axios = require('axios');
-const Catalog = require('./catalog');
-const Kv = require('./kv');
-
-class Consul {
- constructor(config) {
- this.host = config.host;
- this.port = config.port;
-
- this.acl = config.acl;
- this.dc = config.dc || false;
- }
-
- _send(method, uri, body) {
- Eif (this.acl) {
- uri += uri.indexOf('?') > -1 ? '&' : '?';
- uri += `token=${this.acl}`;
- }
- let request = {
- method,
- baseURL: `http://${this.host}:${this.port}`,
- url: `${uri}`,
- transformResponse: [
- (data) => {
- let resp;
- if (!data) {
- return {};
- }
- try {
- resp = JSON.parse(data);
- } catch (error) {
- throw Error(
- `[requestClient] Error parsingJSON data ${error}`
- );
- }
- return resp;
- },
- ],
- };
-
- if (body) {
- request.data = body;
- }
- return axios(request);
- }
-
- _get(uri) {
- return this._send('GET', uri);
- }
-
- /*
- _post (uri, data) {
- if (this.dc) {
- data.Datacenter = this.dc;
- }
-
- return this._send('POST', uri, data);
- }
- */
-
- _put(uri, data) {
- if (this.dc) {
- data.Datacenter = this.dc;
- }
-
- return this._send('PUT', uri, data);
- }
-
- _delete(uri) {
- return this._send('DELETE', uri);
- }
-
- get catalog() {
- return new Catalog(this);
- }
-
- get kv() {
- return new Kv(this);
- }
-}
-
-module.exports = Consul; |
-
-
-
-
-
-
-
-
-
-
diff --git a/coverage/lcov-report/lib/consul/kv.js.html b/coverage/lcov-report/lib/consul/kv.js.html
deleted file mode 100644
index 6e1f1c7..0000000
--- a/coverage/lcov-report/lib/consul/kv.js.html
+++ /dev/null
@@ -1,155 +0,0 @@
-
-
-
- Code coverage report for lib/consul/kv.js
-
-
-
-
-
-
-
-
-
-
-
-
- 88.89%
- Statements
- 8/9
-
-
- 50%
- Branches
- 1/2
-
-
- 100%
- Functions
- 5/5
-
-
- 88.89%
- Lines
- 8/9
-
-
-
-
-
-1
-2
-3
-4
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
-26
-27
-28
-29
-30
-31 |
-
-
-
-5×
-
-
-
-1×
-
-
-
-1×
-
-
-
-1×
-
-
-
-1×
-
-1×
-
-
-
-1×
-
-
-
-1× | 'use strict';
-
-class Kv {
- constructor (consul) {
- this.consul = consul;
- }
-
- keys (prefix) {
- return this.consul._get(`/v1/kv/${prefix}?keys`);
- }
-
- set (key, value) {
- return this.consul._put(`/v1/kv/${key}`, value);
- }
-
- get (key) {
- return this.consul._get(`/v1/kv/${key}?raw`);
- }
-
- delete (key, recurse) {
- let url = `/v1/kv/${key}`;
-
- Iif (recurse === true) {
- url += '?recurse';
- }
-
- return this.consul._delete(url);
- }
-}
-
-module.exports = Kv; |
-
-
-
-
-
-
-
-
-
-
diff --git a/coverage/lcov-report/lib/container-to-consul.js.html b/coverage/lcov-report/lib/container-to-consul.js.html
deleted file mode 100644
index 1acc0e5..0000000
--- a/coverage/lcov-report/lib/container-to-consul.js.html
+++ /dev/null
@@ -1,911 +0,0 @@
-
-
-
- Code coverage report for lib/container-to-consul.js
-
-
-
-
-
-
-
-
-
-
- all files / lib/ container-to-consul.js
-
-
-
- 93.81%
- Statements
- 106/113
-
-
- 86.54%
- Branches
- 45/52
-
-
- 100%
- Functions
- 10/10
-
-
- 93.75%
- Lines
- 105/112
-
-
-
-
-
-1
-2
-3
-4
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
-26
-27
-28
-29
-30
-31
-32
-33
-34
-35
-36
-37
-38
-39
-40
-41
-42
-43
-44
-45
-46
-47
-48
-49
-50
-51
-52
-53
-54
-55
-56
-57
-58
-59
-60
-61
-62
-63
-64
-65
-66
-67
-68
-69
-70
-71
-72
-73
-74
-75
-76
-77
-78
-79
-80
-81
-82
-83
-84
-85
-86
-87
-88
-89
-90
-91
-92
-93
-94
-95
-96
-97
-98
-99
-100
-101
-102
-103
-104
-105
-106
-107
-108
-109
-110
-111
-112
-113
-114
-115
-116
-117
-118
-119
-120
-121
-122
-123
-124
-125
-126
-127
-128
-129
-130
-131
-132
-133
-134
-135
-136
-137
-138
-139
-140
-141
-142
-143
-144
-145
-146
-147
-148
-149
-150
-151
-152
-153
-154
-155
-156
-157
-158
-159
-160
-161
-162
-163
-164
-165
-166
-167
-168
-169
-170
-171
-172
-173
-174
-175
-176
-177
-178
-179
-180
-181
-182
-183
-184
-185
-186
-187
-188
-189
-190
-191
-192
-193
-194
-195
-196
-197
-198
-199
-200
-201
-202
-203
-204
-205
-206
-207
-208
-209
-210
-211
-212
-213
-214
-215
-216
-217
-218
-219
-220
-221
-222
-223
-224
-225
-226
-227
-228
-229
-230
-231
-232
-233
-234
-235
-236
-237
-238
-239
-240
-241
-242
-243
-244
-245
-246
-247
-248
-249
-250
-251
-252
-253
-254
-255
-256
-257
-258
-259
-260
-261
-262
-263
-264
-265
-266
-267
-268
-269
-270
-271
-272
-273
-274
-275
-276
-277
-278
-279
-280
-281
-282
-283 |
-
-22×
-22×
-22×
-22×
-22×
-22×
-
-
-
-21×
-
-21×
-21×
-21×
-
-21×
-
-
-
-25×
-2×
-
-1×
-
-1×
-1×
-
-
-25×
-2×
-
-1×
-
-1×
-1×
-
-
-
-
-
-5×
-
-5×
-
-2×
-1×
-
-1×
-
-
-4×
-6×
-
-6×
-
-
-1×
-1×
-
-
-
-5×
-4×
-
-1×
-1×
-
-
-
-
-3×
-3×
-
-2×
-2×
-
-
-
-
-
-
-
-
-
-2×
-
-
-
-
-
-
-
-
-4×
-
-4×
-4×
-
-
-2×
-1×
-1×
-
-
-1×
-
-
-2×
-
-2×
-2×
-1×
-
-1×
-1×
-1×
-
-
-
-
-
-
-
-
-
-
-2×
-
-
-
-
-2×
-2×
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-2×
-
-2×
-1×
-1×
-
-1×
-1×
-
-
-
-
-
-
-
-
-
-
-3×
-
-
-
-
-
-
-
-
-
-3×
-
-
-
-
-3×
-3×
-
-
-3×
-
-3×
-
-
-3×
-3×
-10×
-
-2×
-2×
-1×
-
-2×
-
-2×
-2×
-2×
-1×
-
-
-
-
-
-
-2×
-
-1×
-1×
-
-1×
-
-2×
-1×
-
-1×
-1×
-
-
-
-
-3×
-
-3×
-
-
-
-
-
-
-
-
-
-3×
-
-3×
-1×
-
-
-3×
-3×
-1×
-
-3×
-2×
-
-3×
-
-3×
-
-
-
-
-
-
-
-
-
-5×
-5×
-1×
-
-5×
-
-
-
-
-22×
- | 'use strict';
-
-const bunyan = require('bunyan');
-const Consul = require('./consul');
-const Docker = require('./docker');
-const Promise = require('bluebird');
-const SkipError = require('./errors/skipError');
-const parse = require('./parse-key-pair');
-
-class ContainertoConsul {
- constructor(config) {
- this.config = config;
-
- this.consul = new Consul(config.consul);
- this.docker = new Docker(this);
- this.log = bunyan.createLogger(config.logger);
-
- this._attachEvents();
- }
-
- _attachEvents() {
- this.docker.events.on('start', msg => {
- return this.docker.client.getContainer(msg.id)
- .inspect()
- .then(container => this.registerContainer(container))
- .catch(error => {
- this.log.error(error);
- throw error;
- });
- });
- this.docker.events.on('die', msg => {
- return this.docker.client.getContainer(msg.id)
- .inspect()
- .then(container => this.deregisterService(this.containerServiceName(container)))
- .catch(error => {
- this.log.error(error);
- throw error;
- });
- });
- }
-
- start() {
- return this.docker.start()
- // deregister containers that do not run
- .then(() => this.consul.kv.keys('docker/service-ids/')
- .catch(error => {
- if (error.statusCode && error.statusCode === 404) {
- return [];
- }
- throw error;
- }))
- .then(keys => {
- return Promise.all(keys.map(key => {
- return this.consul.kv.get(key)
- .then(containerId => {
- return this.docker.client.getContainer(containerId)
- .inspect()
- .then(container => {
- Eif (container.State.Status !== 'running') {
- return this.deregisterService(key);
- }
- })
- .catch(error => {
- if (error.statusCode && error.statusCode === 404) {
- return this.deregisterService(key);
- }
- this.log.error(error);
- throw error;
- });
- });
- }));
- })
- .then(() => this.docker.containers())
- .then(containers => this.registerContainers(containers))
- .catch(error => {
- this.log.error(error);
- throw error;
- });
- }
-
- /**
- *
- * @param {Container[]} containers
- * @returns {Promise.<*>}
- */
- registerContainers(containers) {
- return Promise.all(containers.map(container => this.registerContainer(container)));
- }
-
- /**
- *
- * @param {Container} container
- * @returns {Promise}
- */
- registerContainer(container) {
- let service;
-
- try {
- service = this.container2Service(container);
- }
- catch (e) {
- if (e instanceof SkipError) {
- this.log.info(e.message);
- return Promise.resolve();
- }
-
- return Promise.reject(e);
- }
-
- this.log.info('registering container', service);
-
- return this.registerContainerKv(container)
- .then(() => this.consul.catalog.register(service))
- .then(() => this.consul.kv.set(`docker/service-ids/${this.containerServiceName(container)}`, container.Id))
- .catch(error => {
- this.consul.kv.delete(`services/${this.containerServiceName(container)}`, true);
- this.log.error(error);
- throw error;
- });
- }
-
- /**
- * Registers key/value pairs for the container
- *
- * @param {Container} container
- * @returns {Promise}
- */
- registerContainerKv(container) {
- const
- lbls = this._containerLabels(container),
- promises = [],
- serviceName = this.containerServiceName(container);
-
- Eif (!lbls) {
- return Promise.resolve();
- }
-
- Object.keys(lbls).forEach(label => {
- if (label.startsWith('consul.kv.')) {
- const
- key = label.replace(/^consul\.kv\./, ''),
- val = lbls[label];
-
- promises.push(this.consul.kv.set(`services/${serviceName}/${key}`, val));
- }
- });
-
- return Promise.all(promises);
- }
-
- /**
- * Un-register a service and related information from Consul
- *
- * @param {string} service
- * @returns {Promise}
- */
- deregisterService(service) {
- this.log.info('deregistering container', service);
-
- return this.consul.catalog.deregister({ Node: service })
- .then(() => this.consul.kv.delete(`docker/service-ids/${service}`))
- .then(() => this.consul.kv.delete(`services/${service}`, true))
- .catch(error => {
- this.log.error(error);
- throw error;
- });
- }
-
- /**
- * Given a container, returns a service definition ready to be consumed by Consul catalog/register API endpoint
- *
- * @param container
- * @returns {Object}
- */
- container2Service(container) {
- let service = {
- Node: this.containerServiceName(container),
- Address: this.docker.docker0,
- Service: {
- Service: this.containerServiceName(container),
- Meta: {
- redis_version: '4.0'
- }
- }
- };
- let containerIPAddress = container
- .NetworkSettings
- .Networks[Object.keys(container.NetworkSettings.Networks)[0]]
- .IPAddress;
-
- Eif (containerIPAddress !== '') {
- service.Address = containerIPAddress;
- }
-
- const lbls = this._containerLabels(container);
-
- Iif (Object.keys(lbls).length === 0 || lbls['consul.register'] === 'false' || !lbls['consul.register']) {
- throw new SkipError(`Container ${this.containerServiceName(container)} skipped`);
- }
- Eif (lbls) {
- Object.keys(lbls).forEach(label => {
- switch (label) {
- case 'consul.ip':
- service.Address = lbls[label];
- if (service.Address === 'host') {
- service.Address = this.docker.docker0;
- }
- break;
- case 'consul.port':
- try {
- service.Service.Port = parseInt(lbls[label]);
- if (isNaN(service.Service.Port)) {
- delete service.Service.Port;
- }
- }
- catch (e) {
- // do nothing
- this.log.error(e);
- }
- break;
- case 'consul.service':
- service.Service.Service = lbls[label];
- break;
- case 'consul.tags':
- service.Service.Tags = lbls[label]
- .split(',')
- .map(tag => tag.trim());
- break;
- case 'consul.meta':
- service.Service.Meta = parse(lbls[label]);
- break;
- }
- });
- }
-
- this.log.debug('service', service);
-
- return service;
- }
-
- /**
- * Returns the service name for the container
- *
- * @param {Container} container
- * @returns {string}
- */
- containerServiceName(container) {
- let name = container.Name;
-
- if (!name && container.Names) {
- name = container.Names[0];
- }
-
- let lbls = container.Labels;
- if (!lbls && container.Config && container.Config.Labels) {
- lbls = container.Config.Labels;
- }
- if (lbls && lbls['consul.name']) {
- name = lbls['consul.name'];
- }
- name = name.replace(/^\//, '');
-
- return name;
- }
-
- /**
- *
- * @param container
- * @returns {Object}
- * @private
- */
- _containerLabels(container) {
- let lbls = container.Labels;
- if (!lbls && container.Config && container.Config.Labels) {
- lbls = container.Config.Labels;
- }
- return lbls;
- }
-
-}
-
-module.exports = ContainertoConsul;
- |
-
-
-
-
-
-
-
-
-
-
diff --git a/coverage/lcov-report/lib/docker.js.html b/coverage/lcov-report/lib/docker.js.html
deleted file mode 100644
index a67d4bf..0000000
--- a/coverage/lcov-report/lib/docker.js.html
+++ /dev/null
@@ -1,230 +0,0 @@
-
-
-
- Code coverage report for lib/docker.js
-
-
-
-
-
-
-
-
-
-
-
-
- 100%
- Statements
- 26/26
-
-
- 100%
- Branches
- 2/2
-
-
- 100%
- Functions
- 3/3
-
-
- 100%
- Lines
- 25/25
-
-
-
-
-
-1
-2
-3
-4
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
-26
-27
-28
-29
-30
-31
-32
-33
-34
-35
-36
-37
-38
-39
-40
-41
-42
-43
-44
-45
-46
-47
-48
-49
-50
-51
-52
-53
-54
-55
-56 |
-
-7×
-7×
-7×
-7×
-
-
-
-6×
-
-6×
-6×
-6×
-6×
-
-
-
-
-
-6×
-6×
-
-5×
-4×
-
-4×
-
-4×
-4×
-
-
-
-5×
-1×
-1×
-
-
-
-
-2×
-1×
-
-
-1×
-1×
-
-
-
-
-1×
-
-
-
-7×
- | 'use strict';
-
-const DockerOde = require('dockerode');
-const DockerOdePromise = require('dockerode-promise');
-const DockerEvents = require('docker-events');
-const Promise = require('bluebird');
-
-class Docker {
- constructor (containertoConsul) {
- this.containertoConsul = containertoConsul;
-
- this.config = containertoConsul.config.docker;
- this.client = new DockerOdePromise(this.config);
- this.docker0 = '172.17.0.1';
- this.events = new DockerEvents({
- docker: new DockerOde(this.config)
- });
- }
-
- start () {
- return new Promise((resolve) => {
- this.events.start();
-
- this.events.on('connect', () => {
- this.containertoConsul.log.info('Connected to docker');
-
- return this.client.listNetworks()
- .then(networks => {
- this.docker0 = networks.filter(net => net.Name === 'bridge')[0].IPAM.Config[0].Gateway;
- resolve();
- });
- });
-
- this.events.on('disconnect', () => {
- this.containertoConsul.log.warn('Disconnected from Docker. Reconnecting');
- return this.start();
- });
- })
- .timeout(this.config.connectTimeout)
- .catch(error => {
- if (error instanceof Promise.TimeoutError) {
- return this.start();
- }
-
- this.containertoConsul.log.error(error);
- return Promise.reject(error);
- });
- }
-
- containers () {
- return this.client.listContainers();
- }
-}
-
-module.exports = Docker;
- |
-
-
-
-
-
-
-
-
-
-
diff --git a/coverage/lcov-report/lib/errors/index.html b/coverage/lcov-report/lib/errors/index.html
deleted file mode 100644
index 3210d01..0000000
--- a/coverage/lcov-report/lib/errors/index.html
+++ /dev/null
@@ -1,93 +0,0 @@
-
-
-
- Code coverage report for lib/errors/
-
-
-
-
-
-
-
-
-
-
-
-
- 100%
- Statements
- 2/2
-
-
- 100%
- Branches
- 0/0
-
-
- 100%
- Functions
- 1/1
-
-
- 100%
- Lines
- 2/2
-
-
-
-
-
-
-
-
- File |
- |
- Statements |
- |
- Branches |
- |
- Functions |
- |
- Lines |
- |
-
-
-
- skipError.js |
- |
- 100% |
- 2/2 |
- 100% |
- 0/0 |
- 100% |
- 1/1 |
- 100% |
- 2/2 |
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/coverage/lcov-report/lib/errors/skipError.js.html b/coverage/lcov-report/lib/errors/skipError.js.html
deleted file mode 100644
index 70dbc6e..0000000
--- a/coverage/lcov-report/lib/errors/skipError.js.html
+++ /dev/null
@@ -1,92 +0,0 @@
-
-
-
- Code coverage report for lib/errors/skipError.js
-
-
-
-
-
-
-
-
-
-
-
-
- 100%
- Statements
- 2/2
-
-
- 100%
- Branches
- 0/0
-
-
- 100%
- Functions
- 1/1
-
-
- 100%
- Lines
- 2/2
-
-
-
-
-
-1
-2
-3
-4
-5
-6
-7
-8
-9
-10 |
-
-
-
-1×
-
-
-
-1×
- | 'use strict';
-
-class SkipError extends Error {
- constructor (msg) {
- super(msg);
- }
-}
-
-module.exports = SkipError;
- |
-
-
-
-
-
-
-
-
-
-
diff --git a/coverage/lcov-report/lib/index.html b/coverage/lcov-report/lib/index.html
deleted file mode 100644
index 75760c8..0000000
--- a/coverage/lcov-report/lib/index.html
+++ /dev/null
@@ -1,132 +0,0 @@
-
-
-
- Code coverage report for lib/
-
-
-
-
-
-
-
-
-
-
-
-
- 91.41%
- Statements
- 149/163
-
-
- 78.38%
- Branches
- 58/74
-
-
- 100%
- Functions
- 15/15
-
-
- 91.3%
- Lines
- 147/161
-
-
-
-
-
-
-
-
- File |
- |
- Statements |
- |
- Branches |
- |
- Functions |
- |
- Lines |
- |
-
-
-
- container-to-consul.js |
- |
- 93.81% |
- 106/113 |
- 86.54% |
- 45/52 |
- 100% |
- 10/10 |
- 93.75% |
- 105/112 |
-
-
-
- docker.js |
- |
- 100% |
- 26/26 |
- 100% |
- 2/2 |
- 100% |
- 3/3 |
- 100% |
- 25/25 |
-
-
-
- parse-key-pair.js |
- |
- 70.83% |
- 17/24 |
- 55% |
- 11/20 |
- 100% |
- 2/2 |
- 70.83% |
- 17/24 |
-
-
-
- typedefs.js |
- |
- 100% |
- 0/0 |
- 100% |
- 0/0 |
- 100% |
- 0/0 |
- 100% |
- 0/0 |
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/coverage/lcov-report/lib/typedefs.js.html b/coverage/lcov-report/lib/typedefs.js.html
deleted file mode 100644
index 75948b5..0000000
--- a/coverage/lcov-report/lib/typedefs.js.html
+++ /dev/null
@@ -1,92 +0,0 @@
-
-
-
- Code coverage report for lib/typedefs.js
-
-
-
-
-
-
-
-
-
-
-
-
- 100%
- Statements
- 0/0
-
-
- 100%
- Branches
- 0/0
-
-
- 100%
- Functions
- 0/0
-
-
- 100%
- Lines
- 0/0
-
-
-
-
-
-1
-2
-3
-4
-5
-6
-7
-8
-9
-10 |
-
-
-
-
-
-
-
-
- | /**
- @typedef
- {
- Id: String,
- Labels: String[]
-
-
- } Container
-
- **/ |
-
-
-
-
-
-
-
-
-
-
diff --git a/coverage/lcov-report/prettify.css b/coverage/lcov-report/prettify.css
deleted file mode 100644
index b317a7c..0000000
--- a/coverage/lcov-report/prettify.css
+++ /dev/null
@@ -1 +0,0 @@
-.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}
diff --git a/coverage/lcov-report/prettify.js b/coverage/lcov-report/prettify.js
deleted file mode 100644
index ef51e03..0000000
--- a/coverage/lcov-report/prettify.js
+++ /dev/null
@@ -1 +0,0 @@
-window.PR_SHOULD_USE_CONTINUATION=true;(function(){var h=["break,continue,do,else,for,if,return,while"];var u=[h,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];var p=[u,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"];var l=[p,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"];var x=[p,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"];var R=[x,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"];var r="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes";var w=[p,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"];var s="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END";var I=[h,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"];var f=[h,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"];var H=[h,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"];var A=[l,R,w,s+I,f,H];var e=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/;var C="str";var z="kwd";var j="com";var O="typ";var G="lit";var L="pun";var F="pln";var m="tag";var E="dec";var J="src";var P="atn";var n="atv";var N="nocode";var M="(?:^^\\.?|[+-]|\\!|\\!=|\\!==|\\#|\\%|\\%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|\\,|\\-=|\\->|\\/|\\/=|:|::|\\;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\@|\\[|\\^|\\^=|\\^\\^|\\^\\^=|\\{|\\||\\|=|\\|\\||\\|\\|=|\\~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(Z){var ad=0;var S=false;var ac=false;for(var V=0,U=Z.length;V122)){if(!(al<65||ag>90)){af.push([Math.max(65,ag)|32,Math.min(al,90)|32])}if(!(al<97||ag>122)){af.push([Math.max(97,ag)&~32,Math.min(al,122)&~32])}}}}af.sort(function(av,au){return(av[0]-au[0])||(au[1]-av[1])});var ai=[];var ap=[NaN,NaN];for(var ar=0;arat[0]){if(at[1]+1>at[0]){an.push("-")}an.push(T(at[1]))}}an.push("]");return an.join("")}function W(al){var aj=al.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g"));var ah=aj.length;var an=[];for(var ak=0,am=0;ak=2&&ai==="["){aj[ak]=X(ag)}else{if(ai!=="\\"){aj[ak]=ag.replace(/[a-zA-Z]/g,function(ao){var ap=ao.charCodeAt(0);return"["+String.fromCharCode(ap&~32,ap|32)+"]"})}}}}return aj.join("")}var aa=[];for(var V=0,U=Z.length;V=0;){S[ac.charAt(ae)]=Y}}var af=Y[1];var aa=""+af;if(!ag.hasOwnProperty(aa)){ah.push(af);ag[aa]=null}}ah.push(/[\0-\uffff]/);V=k(ah)})();var X=T.length;var W=function(ah){var Z=ah.sourceCode,Y=ah.basePos;var ad=[Y,F];var af=0;var an=Z.match(V)||[];var aj={};for(var ae=0,aq=an.length;ae=5&&"lang-"===ap.substring(0,5);if(am&&!(ai&&typeof ai[1]==="string")){am=false;ap=J}if(!am){aj[ag]=ap}}var ab=af;af+=ag.length;if(!am){ad.push(Y+ab,ap)}else{var al=ai[1];var ak=ag.indexOf(al);var ac=ak+al.length;if(ai[2]){ac=ag.length-ai[2].length;ak=ac-al.length}var ar=ap.substring(5);B(Y+ab,ag.substring(0,ak),W,ad);B(Y+ab+ak,al,q(ar,al),ad);B(Y+ab+ac,ag.substring(ac),W,ad)}}ah.decorations=ad};return W}function i(T){var W=[],S=[];if(T.tripleQuotedStrings){W.push([C,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""])}else{if(T.multiLineStrings){W.push([C,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"])}else{W.push([C,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"])}}if(T.verbatimStrings){S.push([C,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null])}var Y=T.hashComments;if(Y){if(T.cStyleComments){if(Y>1){W.push([j,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"])}else{W.push([j,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"])}S.push([C,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,null])}else{W.push([j,/^#[^\r\n]*/,null,"#"])}}if(T.cStyleComments){S.push([j,/^\/\/[^\r\n]*/,null]);S.push([j,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}if(T.regexLiterals){var X=("/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/");S.push(["lang-regex",new RegExp("^"+M+"("+X+")")])}var V=T.types;if(V){S.push([O,V])}var U=(""+T.keywords).replace(/^ | $/g,"");if(U.length){S.push([z,new RegExp("^(?:"+U.replace(/[\s,]+/g,"|")+")\\b"),null])}W.push([F,/^\s+/,null," \r\n\t\xA0"]);S.push([G,/^@[a-z_$][a-z_$@0-9]*/i,null],[O,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[F,/^[a-z_$][a-z_$@0-9]*/i,null],[G,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[F,/^\\[\s\S]?/,null],[L,/^.[^\s\w\.$@\'\"\`\/\#\\]*/,null]);return g(W,S)}var K=i({keywords:A,hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true});function Q(V,ag){var U=/(?:^|\s)nocode(?:\s|$)/;var ab=/\r\n?|\n/;var ac=V.ownerDocument;var S;if(V.currentStyle){S=V.currentStyle.whiteSpace}else{if(window.getComputedStyle){S=ac.defaultView.getComputedStyle(V,null).getPropertyValue("white-space")}}var Z=S&&"pre"===S.substring(0,3);var af=ac.createElement("LI");while(V.firstChild){af.appendChild(V.firstChild)}var W=[af];function ae(al){switch(al.nodeType){case 1:if(U.test(al.className)){break}if("BR"===al.nodeName){ad(al);if(al.parentNode){al.parentNode.removeChild(al)}}else{for(var an=al.firstChild;an;an=an.nextSibling){ae(an)}}break;case 3:case 4:if(Z){var am=al.nodeValue;var aj=am.match(ab);if(aj){var ai=am.substring(0,aj.index);al.nodeValue=ai;var ah=am.substring(aj.index+aj[0].length);if(ah){var ak=al.parentNode;ak.insertBefore(ac.createTextNode(ah),al.nextSibling)}ad(al);if(!ai){al.parentNode.removeChild(al)}}}break}}function ad(ak){while(!ak.nextSibling){ak=ak.parentNode;if(!ak){return}}function ai(al,ar){var aq=ar?al.cloneNode(false):al;var ao=al.parentNode;if(ao){var ap=ai(ao,1);var an=al.nextSibling;ap.appendChild(aq);for(var am=an;am;am=an){an=am.nextSibling;ap.appendChild(am)}}return aq}var ah=ai(ak.nextSibling,0);for(var aj;(aj=ah.parentNode)&&aj.nodeType===1;){ah=aj}W.push(ah)}for(var Y=0;Y=S){ah+=2}if(V>=ap){Z+=2}}}var t={};function c(U,V){for(var S=V.length;--S>=0;){var T=V[S];if(!t.hasOwnProperty(T)){t[T]=U}else{if(window.console){console.warn("cannot override language handler %s",T)}}}}function q(T,S){if(!(T&&t.hasOwnProperty(T))){T=/^\s*]*(?:>|$)/],[j,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[L,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^