Files
osem/config/initializers/sentry.rb
Henne Vogelsang ddcd8dfc69 Drop Rails.application.secrets usage
That feature is gone and we already use environment variables...

https://github.com/rails/rails/pull/47801
2025-08-12 17:27:25 +02:00

21 lines
873 B
Ruby

Sentry.init do |config|
config.dsn = ENV.fetch('OSEM_SENTRY_DSN', nil)
config.breadcrumbs_logger = [:active_support_logger]
# To activate performance monitoring, set one of these options.
# We recommend adjusting the value in production:
config.traces_sample_rate = ENV.fetch('OSEM_SENTRY_TRACES_SAMPLE_RATE', '0.5').to_f
# or
# config.traces_sampler = lambda do |context|
# true
# end
# During deployment we touch tmp/restart.txt, let's use its last access time as release.
# Unless someone has set a variable of course...
osem_version_from_file = nil
version_file = File.expand_path('../../tmp/restart.txt', __dir__)
osem_version_from_file = File.new(version_file).atime.strftime('%s') if File.file?(version_file)
osem_version = ENV.fetch('OSEM_SENTRY_RELEASE', osem_version_from_file)
config.release = osem_version if osem_version
end