var path = require('path');
module.exports = {
    site: {
        contactEmail: 'info@ankhor.org',
        baseUrl: "http://localhost:3000/",
        uploadPath: path.join(__dirname, '../public'),
        language:'en'
    },
    mongodb: {
         url: 'mongodb://localhost:27017/psp',
    }
}
I have set static baseUrl in my config file in node.js.How can I do dynamic in different servers?
like:-
var http = require('http');
var url = require('url') ;
http.createServer(function (req, res) {
  var hostname = req.headers.host; // hostname = 'localhost:8080'
  var pathname = url.parse(req.url).pathname; // pathname = '/MyApp'
  console.log('http://' + hostname + pathname);
  res.writeHead(200);
  res.end();
}).listen(8080);
var hostname = req.headers.host; // hostname = 'localhost:8080'
i want this type of output in my config file.