Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set exception_recipients after initialisation? #191

Open
bollard opened this issue Oct 12, 2013 · 1 comment
Open

How to set exception_recipients after initialisation? #191

bollard opened this issue Oct 12, 2013 · 1 comment
Labels

Comments

@bollard
Copy link

bollard commented Oct 12, 2013

I want to be able to define the exception_recipients dynamically, based on the Rails environment. For example:

recipients = Rails.env == 'production'
   [email protected]
else
   User.current.email
end

In this way I won't spam the rest of my team while I am developing new features. but in production we can all respond to issues. However, from the docs:

Whatever::Application.config.middleware.use ExceptionNotification::Rack,
  :email => {
    :email_prefix => "[Whatever] ",
    :sender_address => %{"notifier" <[email protected]>},
    :exception_recipients => %w{[email protected]}
  }

In config/environments/production.rb where i don't have an ActiveRecord::Base connection yet.

Is this possible? Or can there be a call to default_options=(opts)?

Thanks

@Kriechi
Copy link

Kriechi commented Apr 27, 2015

I'm looking for something similar:

I just want to send an email to all Users.where(admin: true).
Tried using a lambda/proc as :exception_recipients - but it seems to get not evaluated once it is needed.
Would be really great to provide a lazy-loading with procs for recipients.

@san650 san650 added the feature label Dec 19, 2015
kellyjosephprice added a commit to kellyjosephprice/exception_notification that referenced this issue Mar 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants