Skip to content

Commit

Permalink
load airbrake api from text file
Browse files Browse the repository at this point in the history
  • Loading branch information
zflat committed Oct 11, 2014
1 parent 8baabb4 commit 8dc5d5d
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ tmp/*
config/database.yml
config/application/secret_token.txt
config/application/secret_base.txt
config/application/err_api_key.txt
config/application/mailer_config.rb
public/photos/*
spec/tmp
Expand Down
5 changes: 5 additions & 0 deletions config/deploy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,22 @@
config/application/secret_base.txt
config/application/secret_token.txt
config/env_vals.rb
config/application/err_api_key.txt
))

# which config files should be copied by deploy:setup_config
# see documentation in lib/capistrano/tasks/setup_config.rake
# for details of operations
#
# Setup by running
# cap <stage> deploy:setup_config
set(:config_files,
[
['database.example.yml', 'config/database.yml'],
['mailer_config.sample.rb','config/application/mailer_config.rb'],
['secret_base.txt','config/application/secret_base.txt'],
['secret_token.txt', 'config/application/secret_token.txt'],
['err_api_key.txt', 'config/application/err_api_key.txt'],
['env_vals.rb', 'config/env_vals.rb']
])

Expand Down
3 changes: 3 additions & 0 deletions config/deploy/shared/err_api_key.txt.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<%=

%>
1 change: 1 addition & 0 deletions config/directories.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
APP_SECRET_BASE_FILE = File.join(APP_CONFIG_DIRECTORY , "secret_base.txt")
APP_MAILER_CONFIG_FILE = File.join(APP_CONFIG_DIRECTORY, "mailer_config.rb")
APP_DB_CONFIG_FILE = File.join(CONFIG_DIRECTORY_ROOT, "database.yml")
ERR_API_KEY = File.join(CONFIG_DIRECTORY_ROOT, "err_api_key.txt")

# tmp

Expand Down
13 changes: 12 additions & 1 deletion config/initializers/airbrake.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
#require File.join(File.dirname(__FILE__) + "../", "config/directories.rb")

require File.expand_path(File.join("..","..","directories.rb"), __FILE__)

puts File.expand_path(File.join("..","..","directories.rb"), __FILE__)

Airbrake.configure do |config|
config.api_key = ENV['ERRAPIKEY']
if ENV["ERR_API_KEY"].present?
config.api_key = ENV["ERR_API_KEY"].strip
elsif File.exists?(ERR_API_KEY)
config.api_key = File.read(File.expand_path(ERR_API_KEY)).strip
end

config.host = 'err.frbp.org'
config.port = 80
config.secure = config.port == 443
Expand Down

0 comments on commit 8dc5d5d

Please sign in to comment.