aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichel Etienne2014-06-05 15:27:09 +0200
committerMichel Etienne2014-06-05 15:27:09 +0200
commit1bb8518426ad091f6730b543b30c6874ae22bdab (patch)
tree2e66864fcb8aaac6d531724b69224223971a3052
parent41317522ac4ffb049ff2fcc70f00f2faebf967db (diff)
downloadchouette-core-1bb8518426ad091f6730b543b30c6874ae22bdab.tar.bz2
add environment variables for debian package install
-rw-r--r--config/environments/production.rb55
1 files changed, 45 insertions, 10 deletions
diff --git a/config/environments/production.rb b/config/environments/production.rb
index 31148daf4..8f4d09b1c 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -2,7 +2,11 @@ ChouetteIhm::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
#
# replace this with your production tracker code
- GA.tracker = "UA-AAAAAAAA"
+ if ENV['CHOUETTE_GOOGLE_ANALYTICS'].nil?
+ GA.tracker = "UA-AAAAAAAA"
+ else
+ GA.tracker = ENV['CHOUETTE_GOOGLE_ANALYTICS']
+ end
# Code is not reloaded between requests
config.cache_classes = true
@@ -35,7 +39,11 @@ ChouetteIhm::Application.configure do
#end
# api key to geoportail IGN (production key link to application url root referer)
- config.geoportail_api_key = "aaaaaaaaaaaaaa"
+ if ENV['CHOUETTE_GEOPORTAIL_KEY'].nil?
+ config.geoportail_api_key = "aaaaaaaaaaaaaa"
+ else
+ config.geoportail_api_key = ENV['CHOUETTE_GEOPORTAIL_KEY']
+ end
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found)
@@ -44,10 +52,19 @@ ChouetteIhm::Application.configure do
# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify
- config.action_mailer.default_url_options = { :host => 'my-domain-name.com' }
+ if ENV['CHOUETTE_BASE_URL'].nil?
+ config.action_mailer.default_url_options = { :host => 'my-domain-name.com' }
+ else
+ config.action_mailer.default_url_options = { :host => ENV['CHOUETTE_BASE_URL'] }
+ end
+
# Configure the e-mail address which will be shown in Devise::Maile
- config.mailer_sender = "chouette-production@my-domain-name.com"
+ if ENV['CHOUETTE_MAIL_SENDER'].nil?
+ config.mailer_sender = "chouette-production@my-domain-name.com"
+ else
+ config.mailer_sender = ENV['CHOUETTE_MAIL_SENDER']
+ end
# mailer configuration :
# by default : set to smtp on windows platforms and sendmail on unix one
@@ -61,14 +78,32 @@ ChouetteIhm::Application.configure do
# :user_name => "username",
# }
#else
- ActionMailer::Base.smtp_settings = {
- :address => "smtp.samle.com",
- :domain => "sample.com"
- }
+ mailer = ""
+ if ENV['CHOUETTE_MAILER'].nil?
+ mailer = "smtp"
+ else
+ mailer = ENV['CHOUETTE_MAILER']
+ end
+ if mailer == "smtp"
+ if ENV['CHOUETTE_SMTP_USER'].nil?
+ ActionMailer::Base.smtp_settings = {
+ :address => ENV['CHOUETTE_SMTP_ADDRESS'].nil? ? "smtp.sample.com" : ENV['CHOUETTE_SMTP_ADDRESS'],
+ :port => ENV['CHOUETTE_SMTP_PORT'].nil? ? 25 : ENV['CHOUETTE_SMTP_PORT'].to_i,
+ :domain => ENV['CHOUETTE_SMTP_DOMAIN'].nil? ? "sample.com" : ENV['CHOUETTE_SMTP_DOMAIN'] }
+ else
+ ActionMailer::Base.smtp_settings = {
+ :address => ENV['CHOUETTE_SMTP_ADDRESS'],
+ :port => ENV['CHOUETTE_SMTP_PORT'].nil? ? 25 : ENV['CHOUETTE_SMTP_PORT'].to_i,
+ :domain => ENV['CHOUETTE_SMTP_DOMAIN'],
+ :user_name => ENV['CHOUETTE_SMTP_USER'],
+ :password => ENV['CHOUETTE_SMTP_PASSWORD'],
+ :authentication => ENV['CHOUETTE_SMTP_AUTH'] }
+ end
+ end
#end
# file to data for demo
- config.demo_data = "/path/to/demo.zip"
+ config.demo_data = ENV['CHOUETTE_DEMO_DATA'].nil? ? "/path/to/demo.zip" : ENV['CHOUETTE_DEMO_DATA']
# link to validation specification pages
config.validation_spec = "http://www.chouette.mobi/neptune-validation/v20/"
@@ -76,7 +111,7 @@ ChouetteIhm::Application.configure do
# paths for external resources
config.to_prepare do
Devise::Mailer.layout "mailer"
- Chouette::Command.command = "/usr/local/opt/chouette-command/chouette-cmd_2.4.0/chouette"
+ Chouette::Command.command = ENV['CHOUETTE_GUI_COMMAND'].nil? "/usr/local/opt/chouette-command/chouette-cmd_2.4.0/chouette" ; ENV['CHOUETTE_GUI_COMMAND']
ImportTask.root = "/var/lib/chouette/imports"
Export.root = "/var/lib/chouette/exports"
end