setup for automatic config for urls

This commit is contained in:
Connor Turland 2014-10-10 21:24:31 -04:00
parent 550e89daef
commit fcdc6d57b2
4 changed files with 11 additions and 10 deletions

View file

@ -1534,12 +1534,9 @@ Metamaps.Util = {
*
*/
Metamaps.Realtime = {
// this is for the heroku staging environment
//Metamaps.Realtime.socket = io.connect('http://gentle-savannah-1303.herokuapp.com');
// this is for metamaps.cc
//Metamaps.Realtime.socket = io.connect('http://metamaps.cc:5001');
// this is for localhost development
//Metamaps.Realtime.socket = io.connect('http://localhost:5001');
stringForLocalhost: 'http://localhost:5001',
stringForMetamaps: 'http://metamaps.cc:5001',
stringForHeroku: 'http://gentle-savannah-1303.herokuapp.com',
socket: null,
isOpen: false,
changing: false,
@ -1560,7 +1557,9 @@ Metamaps.Realtime = {
});
$('body').click(self.close);
self.socket = io.connect('http://gentle-savannah-1303.herokuapp.com'); // io.connect('http://localhost:5001');
var railsEnv = $('body').data('env');
var whichToConnect = railsEnv === 'development' ? self.stringForLocalhost : self.stringForHeroku;
self.socket = io.connect(whichToConnect);
self.startActiveMap();
},
toggleBox: function (event) {

View file

@ -26,7 +26,7 @@
</script>
</head>
<body>
<body data-env="<%= Rails.env %>">
<% if notice %>
<p id="toast"><%= notice %></p>

View file

@ -3,7 +3,7 @@ class GrabMapScreenshotWorker
include Sidekiq::Worker
def perform(map_id)
imgBase64 = `phantomjs ./script/phantomjs-save-screenshot.js #{map_id}`
imgBase64 = `phantomjs ./script/phantomjs-save-screenshot.js #{map_id} #{Rails.env}`
map = Map.find(map_id)
map.decode_base64(imgBase64)
end

View file

@ -8,7 +8,9 @@ if (args.length <= 1) {
//configurable variables - CHANGE ME
var mapID = args[1];
var url = 'http://metamaps.herokuapp.com/maps/' + mapID;
var environment = args[2];
var address = environment === 'development' ? 'http://localhost:3000' : 'http://metamaps.herokuapp.com';
var url = address + '/maps/' + mapID;
var width = 940;
var height = 630;