Skip to content
This repository was archived by the owner on Sep 21, 2022. It is now read-only.

Commit 223d3aa

Browse files
author
Lucas Simeon
committed
Add Sentry feature (via plugin)
Add the plugin https://github.com/stayallive/wp-sentry in SAO and configure constants
1 parent 69a65b8 commit 223d3aa

File tree

4 files changed

+41
-1
lines changed

4 files changed

+41
-1
lines changed

saofile.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ module.exports = {
5353
{ name: 'Wordfence', value: 'wordfence' },
5454
{ name: 'WP Rocket', value: 'wpRocket' },
5555
{ name: 'Rank Math', value: 'rankMath' },
56+
{ name: 'Sentry', value: 'sentry' },
5657
],
5758
default: ['acf', 'wpRocket', 'classicEditor'],
5859
},
@@ -64,13 +65,15 @@ module.exports = {
6465
const wordfence = features.includes('wordfence');
6566
const wpRocket = features.includes('wpRocket');
6667
const rankMath = features.includes('rankMath');
68+
const sentry = features.includes('sentry');
6769

6870
return {
6971
acf,
7072
classicEditor,
7173
wordfence,
7274
wpRocket,
7375
rankMath,
76+
sentry,
7477
};
7578
},
7679
actions() {

template/.env.example

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,18 @@ AUTH_SALT=''
3434
SECURE_AUTH_SALT=''
3535
LOGGED_IN_SALT=''
3636
NONCE_SALT=''
37-
3837
<%_ if (wpRocket) { _%>
3938

4039
# WP Rocket config
4140
WP_ROCKET_EMAIL=''
4241
WP_ROCKET_KEY=''
4342
WP_CACHE=false
4443
<%_ } _%>
44+
<%_ if (sentry) { _%>
45+
46+
# Sentry configuration (https://github.com/stayallive/wp-sentry)
47+
WP_SENTRY_PHP_DSN=''
48+
WP_SENTRY_BROWSER_DSN=''
49+
WP_SENTRY_BROWSER_TRACES_SAMPLE_RATE=false
50+
WP_SENTRY_ENV=''
51+
<%_ } _%>

template/bin/source/wp-config-sample.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,33 @@
118118
define( 'WP_ROCKET_KEY', getenv( 'WP_ROCKET_KEY' ) );
119119
define( 'WP_CACHE', getenv( 'WP_CACHE' ) === 'true' );
120120
<%_ } _%>
121+
<%_ if (sentry) { _%>
122+
123+
/**
124+
* Sentry config
125+
* @see https://github.com/stayallive/wp-sentry
126+
*/
127+
128+
$version_file_path = dirname( __DIR__ ) . '/package.json';
129+
$version = '';
130+
if ( file_exists( $version_file_path ) ) {
131+
$package_content = file_get_contents( $version_file_path );
132+
133+
if ($package_content) {
134+
$package = json_decode( $package_content );
135+
136+
if ( is_object( $package ) && isset( $package->name, $package->version ) ) {
137+
$version = $package->name . '@' . $package->version;
138+
}
139+
}
140+
}
141+
142+
define( 'WP_SENTRY_VERSION', $version );
143+
define( 'WP_SENTRY_PHP_DSN', getenv( 'WP_SENTRY_PHP_DSN' ) );
144+
define( 'WP_SENTRY_BROWSER_DSN', getenv( 'WP_SENTRY_BROWSER_DSN' ) );
145+
define( 'WP_SENTRY_BROWSER_TRACES_SAMPLE_RATE', getenv( 'WP_SENTRY_BROWSER_TRACES_SAMPLE_RATE' ) );
146+
define( 'WP_SENTRY_ENV', (getenv('WP_SENTRY_ENV')) ? getenv('WP_SENTRY_ENV') : getenv('APP_ENV') );
147+
<%_ } _%>
121148

122149
/* Set default theme */
123150
define( 'WP_DEFAULT_THEME', '<%= slug %>' );

template/composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
<%_ if (rankMath) { _%>
2626
"wpackagist-plugin/seo-by-rank-math": "^1.0",
2727
<%_ } _%>
28+
<%_ if (sentry) { _%>
29+
"stayallive/wp-sentry": "^4.16",
30+
<%_ } _%>
2831
<%_ if (acf) { _%>
2932
"studiometa/advanced-custom-fields-pro": "^5.9.6",
3033
"stoutlogic/acf-builder": "^1.10",

0 commit comments

Comments
 (0)