Skip to content

Commit 044e649

Browse files
committed
Sentry 필터와 소스맵 설정 정렬
1 parent 74aaf2e commit 044e649

6 files changed

Lines changed: 27 additions & 11 deletions

File tree

frontend/build/webpack.prod.conf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const webpackConfig = merge(baseWebpackConfig, {
2020
extract: true,
2121
}),
2222
},
23-
devtool: config.build.productionSourceMap ? "#hidden-source-map" : false,
23+
devtool: config.build.productionSourceMap ? "hidden-source-map" : false,
2424
output: {
2525
path: config.build.assetsRoot,
2626
filename: utils.assetsPath("js/[name].[chunkhash].js"),

frontend/config/dev.env.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
// let date = require('moment')().format('YYYYMMDD')
22
// let commit = require('child_process').execSync('git rev-parse HEAD').toString().slice(0, 5)
33
// let version = `"${date}-${commit}"`
4+
const sentry = require("./sentry")
5+
46
let version = JSON.stringify(process.env.VUE_APP_VERSION || "dev")
5-
let useSentry = JSON.stringify(
6-
process.env.USE_SENTRY || (process.env.NODE_ENV === "production" ? "1" : "0"),
7-
)
8-
let sentryDsn = JSON.stringify(
9-
process.env.SENTRY_DSN ||
10-
"https://143814aaa2d6e0b4550b2e5effefe90d@o4511586463776768.ingest.us.sentry.io/4511586483634176",
11-
)
7+
let useSentry = JSON.stringify(sentry.isSentryEnabled() ? "1" : "0")
8+
let sentryDsn = JSON.stringify(sentry.getSentryDsn())
129

1310
console.log(`current version is ${version}`)
1411

frontend/config/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// see http://vuejs-templates.github.io/webpack for documentation.
44

55
const path = require("path")
6+
const sentry = require("./sentry")
67
const commonProxy = {
78
onProxyReq: (proxyReq, req, res) => {
89
proxyReq.setHeader("Referer", process.env.TARGET)
@@ -21,7 +22,7 @@ module.exports = {
2122
assetsRoot: path.resolve(__dirname, "../dist"),
2223
assetsSubDirectory: "static",
2324
assetsPublicPath: "/__STATIC_CDN_HOST__/",
24-
productionSourceMap: process.env.USE_SENTRY === "1",
25+
productionSourceMap: sentry.isSentryEnabled("production"),
2526
// Gzip off by default as many popular static hosts such as
2627
// Surge or Netlify already gzip all static assets for you.
2728
// Before setting to `true`, make sure to:

frontend/config/sentry.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
"use strict"
2+
3+
function isSentryEnabled(nodeEnv = process.env.NODE_ENV) {
4+
return (process.env.USE_SENTRY || (nodeEnv === "production" ? "1" : "0")) === "1"
5+
}
6+
7+
function getSentryDsn() {
8+
return (
9+
process.env.SENTRY_DSN ||
10+
"https://143814aaa2d6e0b4550b2e5effefe90d@o4511586463776768.ingest.us.sentry.io/4511586483634176"
11+
)
12+
}
13+
14+
module.exports = {
15+
getSentryDsn,
16+
isSentryEnabled,
17+
}

frontend/deploy/sentry_release.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
DATE=`date +%Y%m%d`
44
COMMIT=`git rev-parse HEAD`
55
VERSION="$DATE-${COMMIT:0:5}"
6+
USE_SENTRY="${USE_SENTRY:-1}"
67

78
echo "Current version is $VERSION"
89

9-
if [ ! -z $USE_SENTRY ] && [ $USE_SENTRY == '1' ]; then
10+
if [ "$USE_SENTRY" == '1' ]; then
1011

1112
# create new release according to `VERSION`
1213
docker run --rm -it -v $(pwd):/work getsentry/sentry-cli \

frontend/src/utils/sentry.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const SENTRY_DSN =
66
const options = {
77
release: process.env.VERSION,
88
environment: process.env.NODE_ENV,
9-
ignoreUrls: [
9+
denyUrls: [
1010
// Chrome extensions
1111
/extensions\//i,
1212
/^chrome:\/\//i,

0 commit comments

Comments
 (0)