Skip to content

Commit

Permalink
Merge pull request #494 from t3-innovation-network/staging
Browse files Browse the repository at this point in the history
Release 04/10/2024
  • Loading branch information
shlag3n authored Apr 10, 2024
2 parents 2a64b31 + fb51bbd commit ba0098e
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 1 deletion.
6 changes: 5 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,8 @@ POSTGRESQL_ADDRESS=db
POSTGRESQL_DATABASE=desm_development
POSTGRESQL_USERNAME=postgres
POSTGRESQL_PASSWORD=postgres
POSTGRESQL_PORT=5432
POSTGRESQL_PORT=5432

# airbrake
AIRBRAKE_PROJECT_ID=
AIRBRAKE_PROJECT_KEY=
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ gem "rack-cors", require: "rack/cors"
# REST OF THE DEPENDENCIES

gem "active_model_serializers", "~> 0.10"
gem "airbrake"

# Audit changes
gem "audited", "~> 4.9"
Expand Down
6 changes: 6 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ GEM
zeitwerk (~> 2.3)
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
airbrake (13.0.4)
airbrake-ruby (~> 6.0)
airbrake-ruby (6.2.2)
rbtree3 (~> 0.6)
annotate (3.2.0)
activerecord (>= 3.2, < 8.0)
rake (>= 10.4, < 14.0)
Expand Down Expand Up @@ -342,6 +346,7 @@ GEM
rb-inotify (0.10.1)
ffi (~> 1.0)
rbs (2.8.4)
rbtree3 (0.7.1)
rdf (3.3.1)
bcp47_spec (~> 0.2)
link_header (~> 0.0, >= 0.0.8)
Expand Down Expand Up @@ -585,6 +590,7 @@ PLATFORMS

DEPENDENCIES
active_model_serializers (~> 0.10)
airbrake
annotate
audited (~> 4.9)
bcrypt (~> 3.1, >= 3.1.15)
Expand Down
80 changes: 80 additions & 0 deletions config/initializers/airbrake.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# frozen_string_literal: true

# Airbrake is an online tool that provides robust exception tracking in your
# Rails applications. In doing so, it allows you to easily review errors, tie an
# error to an individual piece of code, and trace the cause back to recent
# changes. Airbrake enables for easy categorization, searching, and
# prioritization of exceptions so that when errors occur, your team can quickly
# determine the root cause.
#
# Configuration details:
# https://github.com/airbrake/airbrake-ruby#configuration
if (project_id = ENV['AIRBRAKE_PROJECT_ID']) &&
project_key = (ENV['AIRBRAKE_PROJECT_KEY'] || ENV['AIRBRAKE_API_KEY'])
Airbrake.configure do |c|
# You must set both project_id & project_key. To find your project_id and
# project_key navigate to your project's General Settings and copy the
# values from the right sidebar.
# https://github.com/airbrake/airbrake-ruby#project_id--project_key
c.project_id = project_id
c.project_key = project_key

# Configures the root directory of your project. Expects a String or a
# Pathname, which represents the path to your project. Providing this option
# helps us to filter out repetitive data from backtrace frames and link to
# GitHub files from our dashboard.
# https://github.com/airbrake/airbrake-ruby#root_directory
c.root_directory = Rails.root

# By default, Airbrake Ruby outputs to STDOUT. In Rails apps it makes sense
# to use the Rails' logger.
# https://github.com/airbrake/airbrake-ruby#logger
c.logger = Airbrake::Rails.logger

# Configures the environment the application is running in. Helps the
# Airbrake dashboard to distinguish between exceptions occurring in
# different environments.
# NOTE: This option must be set in order to make the 'ignore_environments'
# option work.
# https://github.com/airbrake/airbrake-ruby#environment
c.environment = Rails.env

# Setting this option allows Airbrake to filter exceptions occurring in
# unwanted environments such as :test. NOTE: This option *does not* work if
# you don't set the 'environment' option.
# https://github.com/airbrake/airbrake-ruby#ignore_environments
c.ignore_environments = %w[test]

# A list of parameters that should be filtered out of what is sent to
# Airbrake. By default, all "password" attributes will have their contents
# replaced.
# https://github.com/airbrake/airbrake-ruby#blocklist_keys
c.blocklist_keys = [/password/i, /authorization/i]

# Alternatively, you can integrate with Rails' filter_parameters.
# Read more: https://goo.gl/gqQ1xS
# c.blocklist_keys = Rails.application.config.filter_parameters
end

# A filter that collects request body information. Enable it if you are sure you
# don't send sensitive information to Airbrake in your body (such as passwords).
# https://github.com/airbrake/airbrake#requestbodyfilter
# Airbrake.add_filter(Airbrake::Rack::RequestBodyFilter.new)

# Attaches thread & fiber local variables along with general thread information.
# Airbrake.add_filter(Airbrake::Filters::ThreadFilter.new)

# Attaches loaded dependencies to the notice object
# (under context/versions/dependencies).
# Airbrake.add_filter(Airbrake::Filters::DependencyFilter.new)

# If you want to convert your log messages to Airbrake errors, we offer an
# integration with the Logger class from stdlib.
# https://github.com/airbrake/airbrake#logger
# Rails.logger = Airbrake::AirbrakeLogger.new(Rails.logger)
else
Rails.logger.warn(
"#{__FILE__}: Airbrake project id or project key is not set. " \
"Skipping Airbrake configuration"
)
end

0 comments on commit ba0098e

Please sign in to comment.