1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
  | 
ChouetteIhm::Application.configure do
  # Settings specified here will take precedence over those in config/application.rb
  # Code is not reloaded between requests
  config.cache_classes = true
  # Full error reports are disabled and caching is turned on
  config.consider_all_requests_local       = false
  config.action_controller.perform_caching = true
  # Disable Rails's static asset server (Apache or nginx will already do this)
  config.serve_static_assets = true
  # Compress JavaScripts and CSS
  config.assets.compress = false
  # Don't fallback to assets pipeline if a precompiled asset is missed
  config.assets.compile = false
  # Generate digests for assets URLs
  config.assets.digest = true
  # Defaults to Rails.root.join("public/assets")
  # config.assets.manifest = YOUR_PATH
  # Specifies the header that your server uses for sending files
  # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
  # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
  # config.force_ssl = true
  # See everything in the log (default is :info)
  #config.log_level = :info
  # Use a different logger for distributed setups
  #if ENV['OS'] == 'Windows_NT'
  #  # args = log_path,number of files,file sizes
  #  config.logger = Logger.new("C:/chouette/logs/chouette2.log", 5, 10.megabytes)
  #else
  require 'syslog_logger'
  config.logger = SyslogLogger.new("rails/chouette2").tap do |logger|
    logger.level = Logger::INFO
  end
  #end
  # Use a different cache store in production
  # config.cache_store = :mem_cache_store
  # Enable serving of images, stylesheets, and JavaScripts from an asset server
  # config.action_controller.asset_host = "chouette2"
  # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
  # config.assets.precompile += %w( search.js )
  # Disable delivery errors, bad email addresses will be ignored
  # config.action_mailer.raise_delivery_errors = false
  
  # Enable threaded mode
  # NOTICE : With Rails 3.2, Delayed::JRubyWorker blocks the application without threaded mode
  # config.threadsafe!
  # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
  # the I18n.default_locale when a translation can not be found)
  config.i18n.fallbacks = true
  # Send deprecation notices to registered listeners
  config.active_support.deprecation = :notify
  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
  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
  #               may be changed as convenience
  #if ENV['OS'] == 'Windows_NT'
  #  ## using SMTP (maybe useful for Windows or VM platforms):
  #   ActionMailer::Base.delivery_method = :smtp
  #   ActionMailer::Base.smtp_settings = {
  #     :address => "smtp.sample.com",
  #     :domain => "sample.com",
  #     :user_name => "username",
  #   }
  #else
  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
  # replace this with your production tracker code
  # replace this with your production tracker code
  if ENV['CHOUETTE_GOOGLE_ANALYTICS'].nil?
     GA.tracker = "UA-AAAAAAAA"
  else
     GA.tracker = ENV['CHOUETTE_GOOGLE_ANALYTICS']
  end  
  # api key to geoportail IGN (production key link to application url root referer)
  if ENV['CHOUETTE_GEOPORTAIL_KEY'].nil?
     config.geoportail_api_key = "aaaaaaaaaaaaaa"
  else
     config.geoportail_api_key = ENV['CHOUETTE_GEOPORTAIL_KEY']
  end  
  # Specific for each company
  config.company_name = "afimb"
  config.company_theme = "#61970b"
  config.company_contact = "http://www.chouette.mobi/contact-support/"
  # file to data for demo
  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/"
  # paths for external resources
  config.to_prepare do
    Devise::Mailer.layout "mailer"
    Chouette::Command.command = ENV['CHOUETTE_GUI_COMMAND'].nil? ? "/usr/local/opt/chouette-command/chouette-cmd_2.5.0/chouette" : ENV['CHOUETTE_GUI_COMMAND']
    ImportTask.root = "/var/lib/chouette/imports"
    Export.root = "/var/lib/chouette/exports"
  end
end
  |