move more config into .example-env

This commit is contained in:
Devin Howard 2016-01-06 22:57:01 +08:00
parent 70f5a5db11
commit 3cdab531a6
4 changed files with 14 additions and 9 deletions

View file

@ -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

View file

@ -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();
});

View file

@ -66,7 +66,7 @@
<![endif]-->
</head>
<body data-env="<%= Rails.env %>" class="<%= authenticated? ? "authenticated" : "unauthenticated" %>">
<body class="<%= authenticated? ? "authenticated" : "unauthenticated" %>">
<% if devise_error_messages? %>
<p id="toast"><%= devise_error_messages! %></p>

View file

@ -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