From 3cdab531a67df33a46690734e982ae23d7c40df5 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Wed, 6 Jan 2016 22:57:01 +0800 Subject: [PATCH] move more config into .example-env --- .example-env | 11 ++++++++++- app/assets/javascripts/src/Metamaps.js.erb | 8 ++------ app/views/layouts/application.html.erb | 2 +- config/environments/production.rb | 2 +- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/.example-env b/.example-env index b974c5b2..417e79ea 100644 --- a/.example-env +++ b/.example-env @@ -4,7 +4,16 @@ export DB_USERNAME='postgres' export DB_PASSWORD='3112' export DB_HOST='localhost' export DB_PORT='5432' -export REALTIME_SERVER='https://realtime.metamaps.cc' + +export MAILER_DEFAULT_URL='localhost:3000' +# you could also use +# export MAILER_DEFAULT_URL='metamaps.herokuapp.com' + +export REALTIME_SERVER='http://localhost:5001' +# you could also use +# export REALTIME_SERVER='https://realtime.metamaps.cc' +# export REALTIME_SERVER='https://my-heroku-realtime-server.herokuapp.com', + # you can safely leave the rest of these blank, unless you're # deploying an instance, in which case you'll need to set them up diff --git a/app/assets/javascripts/src/Metamaps.js.erb b/app/assets/javascripts/src/Metamaps.js.erb index 069fdc21..c8e61868 100644 --- a/app/assets/javascripts/src/Metamaps.js.erb +++ b/app/assets/javascripts/src/Metamaps.js.erb @@ -1910,9 +1910,6 @@ Metamaps.Util = { * */ Metamaps.Realtime = { - stringForLocalhost: '//localhost:5001', - stringForMetamaps: 'https://realtime.metamaps.cc', - stringForHeroku: 'https://gentle-savannah-1303.herokuapp.com', socket: null, isOpen: false, changing: false, @@ -1936,9 +1933,8 @@ Metamaps.Realtime = { }); $('body').click(self.close); - var railsEnv = $('body').data('env'); - var whichToConnect = railsEnv === 'development' ? self.stringForLocalhost : self.stringForHeroku; - self.socket = io.connect(whichToConnect); + var realtimeServerUrl = '<%= ENV['REALTIME_SERVER'] %>' + self.socket = io.connect(realtimeServerUrl); self.socket.on('connect', function () { self.startActiveMap(); }); diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 8057d576..03a9ebf7 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -66,7 +66,7 @@ -"> +"> <% if devise_error_messages? %>

<%= devise_error_messages! %>

diff --git a/config/environments/production.rb b/config/environments/production.rb index 55220ee3..9654962a 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -42,7 +42,7 @@ Metamaps::Application.configure do authentication: 'plain', enable_starttls_auto: true, openssl_verify_mode: 'none' } - config.action_mailer.default_url_options = { :host => 'metamaps.herokuapp.com' } + config.action_mailer.default_url_options = { :host => ENV['MAILER_DEFAULT_URL'] } # Don't care if the mailer can't send config.action_mailer.raise_delivery_errors = true