Closed chrisatomix closed 5 years ago
Just a quick update, here's what we added to the end of the bugsnag.php plugin file to enable this in the latest version 1.3.0:
function bugsnag_define_api_key() {
return defined('BUGSNAG_API_KEY') ? BUGSNAG_API_KEY : false;
}
add_filter('pre_option_bugsnag_api_key', 'bugsnag_define_api_key');
add_filter('pre_site_option_bugsnag_api_key', 'bugsnag_define_api_key');
$bugsnagWordpress = new Bugsnag_Wordpress();
Thanks for the detailed report, @chrisatomix. I think this would be a good addition, as it sounds like a useful behavior and not unlike what happens in other bugsnag PHP libraries.
Available in v1.4.0.
Hi, Due to the way we work on our sites across multiple environments (3-6 Development servers, plus Staging and Production, etc), we occasionally have issues with the Bugsnag plugin being enabled on the wrong environment. For example, a Developer brings in the database from the Production site to make local changes, and this causes his Bugsnag installation to start reporting bugs.
To get around this we added the following method to the Bugsnag class in the plugin:
If the BUGSNAG_API_KEY constant has been defined, it will use that. Otherwise it falls back to the key defined in the database (which we usually leave blank).
We can then add code like this in our configuration:
Is there any chance of a similar feature being added to this plugin? We're more than happy to contribute a PR to save us from having to maintain our own fork, with some guidance from the plugin maintainers. Our current fork is out of date and doesn't include all the new network site options, so this could cause some issues if incorrectly implemented.
Thanks in advance