diff --git a/Bikes/server.js b/Bikes/server.js index 276d407..1602c80 100644 --- a/Bikes/server.js +++ b/Bikes/server.js @@ -15,8 +15,10 @@ var async = require('async'); // var mongoDBCollection = process.env.mongo_collection; var mongoDBCollection = "bikes"; -// var mongoDBConnStr = "mongodb://databases-mongo"; -var mongoDBConnStr = "mongodb://" + process.env.mongo_connectionstring + ":" + process.env.mongo_port; +var mongoDBConnStr = "mongodb://databases-mongo"; +if (process.env.mongo_port) { + mongoDBConnStr = "mongodb://" + process.env.mongo_connectionstring + ":" + process.env.mongo_port; +} console.log("Collection: " + mongoDBCollection); console.log("MongoDB connection string: " + mongoDBConnStr); @@ -242,10 +244,10 @@ app.get('/api/bikes/:bikeId', function(req, res) { theBike.id = theBike._id; delete theBike._id; - // if (req.query["unitType"] == "imperial") { - // theBike.suitableHeightInMeters = theBike.suitableHeightInMeters * 300; // 3.28084; - // theBike.maximumWeightInKg = theBike.maximumWeightInKg * 300; // 2.204623; - // } + if (req.query["unitType"] == "imperial") { + theBike.suitableHeightInMeters = theBike.suitableHeightInMeters * 3.28084; + theBike.maximumWeightInKg = theBike.maximumWeightInKg * 2.204623; + } res.send(theBike); }); diff --git a/Bikes/service.env b/Bikes/service.env deleted file mode 100644 index d4b1cb0..0000000 --- a/Bikes/service.env +++ /dev/null @@ -1,2 +0,0 @@ -mongo_connectionstring=${services.databases-mongo} -mongo_port=${services.databases-mongo.port} \ No newline at end of file