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 = { Metamaps.Realtime = {
// this is for the heroku staging environment stringForLocalhost: 'http://localhost:5001',
//Metamaps.Realtime.socket = io.connect('http://gentle-savannah-1303.herokuapp.com'); stringForMetamaps: 'http://metamaps.cc:5001',
// this is for metamaps.cc stringForHeroku: 'http://gentle-savannah-1303.herokuapp.com',
//Metamaps.Realtime.socket = io.connect('http://metamaps.cc:5001');
// this is for localhost development
//Metamaps.Realtime.socket = io.connect('http://localhost:5001');
socket: null, socket: null,
isOpen: false, isOpen: false,
changing: false, changing: false,
@ -1560,7 +1557,9 @@ Metamaps.Realtime = {
}); });
$('body').click(self.close); $('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(); self.startActiveMap();
}, },
toggleBox: function (event) { toggleBox: function (event) {

View file

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

View file

@ -3,7 +3,7 @@ class GrabMapScreenshotWorker
include Sidekiq::Worker include Sidekiq::Worker
def perform(map_id) 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 = Map.find(map_id)
map.decode_base64(imgBase64) map.decode_base64(imgBase64)
end end

View file

@ -8,7 +8,9 @@ if (args.length <= 1) {
//configurable variables - CHANGE ME //configurable variables - CHANGE ME
var mapID = args[1]; 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 width = 940;
var height = 630; var height = 630;