added support for mongo authentication
now automatically set correct endpoint for js