diff --git a/.gitignore b/.gitignore index b729e8e..d581aa0 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/config/deploy.rb b/config/deploy.rb index 10a4140..9fb1231 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -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 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'] ]) diff --git a/config/deploy/shared/err_api_key.txt.erb b/config/deploy/shared/err_api_key.txt.erb new file mode 100644 index 0000000..c3cfe2d --- /dev/null +++ b/config/deploy/shared/err_api_key.txt.erb @@ -0,0 +1,3 @@ +<%= + +%> \ No newline at end of file diff --git a/config/directories.rb b/config/directories.rb index c44e8b6..acd17ba 100644 --- a/config/directories.rb +++ b/config/directories.rb @@ -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 diff --git a/config/initializers/airbrake.rb b/config/initializers/airbrake.rb index 4def9d9..4c98e6c 100644 --- a/config/initializers/airbrake.rb +++ b/config/initializers/airbrake.rb @@ -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