File tree Expand file tree Collapse file tree 3 files changed +10
-3
lines changed
Expand file tree Collapse file tree 3 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ public static function instance()
1919
2020 public function environment ()
2121 {
22- return getenv ( ' WP_ENV ' ) ?: null ;
22+ return \ Rollbar \ Wordpress \Plugin:: getEnvironment () ;
2323 }
2424
2525 public function root ()
Original file line number Diff line number Diff line change @@ -52,6 +52,11 @@ public function configure(array $config) {
5252 private function initSettings () {
5353 Settings::init ();
5454 }
55+
56+ public static function getEnvironment ()
57+ {
58+ return ( getenv ('WP_ENV ' ) ?: ( defined ( 'WP_ENV ' ) ? WP_ENV : null ) );
59+ }
5560
5661 /**
5762 * Fetch settings provided in Admin -> Tools -> Rollbar
@@ -68,7 +73,7 @@ private function fetchSettings() {
6873
6974 if (!isset ($ options ['environment ' ]) || empty ($ options ['environment ' ])) {
7075
71- if ($ wpEnv = getenv ( ' WP_ENV ' )) {
76+ if ($ wpEnv = $ this -> getEnvironment ( )) {
7277 $ options ['environment ' ] = $ wpEnv ;
7378 }
7479
Original file line number Diff line number Diff line change @@ -220,8 +220,10 @@ public static function status($settings)
220220
221221 public static function environmentSettingNote ()
222222 {
223+ $ env = \Rollbar \Wordpress \Plugin::getEnvironment ();
224+
223225 $ output =
224- '<p><code>WP_ENV</code> environment variable: <code> ' . getenv ( ' WP_ENV ' ) . ' </code></p> ' .
226+ '<p><code>WP_ENV</code> environment variable: <code> ' . $ env . '</code></p> ' .
225227 '<p><small><strong>Rollbar for Wordpress honors the WP_ENV environment variable.</strong> ' .
226228 'If the <code>environment</code> setting is not specified here, it will take ' .
227229 'precendence over the default value.</strong></small></p> ' ;
You can’t perform that action at this time.
0 commit comments