allow airbrake configuration via configuration.yml or env vars

pull/2729/head
Martin Linkhorst 10 years ago
parent 0082c4485a
commit b59059ae89
  1. 7
      config/configuration.yml.example
  2. 10
      config/initializers/airbrake.rb

@ -205,6 +205,13 @@ default:
# possible values are :cookie_store, :cache_store, :active_record_store
session_store: :cache_store
# define your airbrake api key. optionally provide a different host and port
# to connect to a different backend (e.g. a self-hosted errbit)
# airbrake:
# api_key: <your_api_key>
# host: errbit.example.org
# post: 443
# Configuration of SCM executable command.
# Absolute path (e.g. /usr/local/bin/hg) or command name (e.g. hg.exe, bzr.exe)
# On Windows, *.cmd, *.bat (e.g. hg.cmd, bzr.bat) does not work.

@ -1,8 +1,10 @@
if ENV['AIRBRAKE_API_KEY']
airbrake = OpenProject::Configuration['airbrake']
if airbrake && airbrake['api_key']
Airbrake.configure do |config|
config.api_key = ENV.fetch('AIRBRAKE_API_KEY')
config.host = ENV['AIRBRAKE_HOST'] if ENV['AIRBRAKE_HOST']
config.port = ENV.fetch('AIRBRAKE_PORT', 443)
config.api_key = airbrake['api_key']
config.host = airbrake['host'] if airbrake['host']
config.port = Integer(airbrake['port'] || 443)
config.secure = config.port == 443
end
end

Loading…
Cancel
Save