Merge pull request #280 from ente-io/disable-sentry-release-cli-for-local-build
disable sentry release cli for local build
This commit is contained in:
commit
5d3e284fcd
|
@ -1,4 +1,5 @@
|
|||
const cp = require('child_process');
|
||||
const { isSentryEnabled } = require('./sentryConfigUtil');
|
||||
|
||||
module.exports = {
|
||||
COOP_COEP_HEADERS: {
|
||||
|
@ -50,4 +51,5 @@ module.exports = {
|
|||
cwd: __dirname,
|
||||
encoding: 'utf8',
|
||||
}),
|
||||
isSentryEnabled: isSentryEnabled,
|
||||
};
|
||||
|
|
|
@ -14,15 +14,18 @@ const {
|
|||
CSP_DIRECTIVES,
|
||||
WORKBOX_CONFIG,
|
||||
ALL_ROUTES,
|
||||
isSentryEnabled,
|
||||
} = require('./configUtil');
|
||||
|
||||
const gitSha = getGitSha();
|
||||
const GIT_SHA = getGitSha();
|
||||
|
||||
const SENTRY_ENABLED = isSentryEnabled();
|
||||
|
||||
module.exports = withSentryConfig(
|
||||
withWorkbox(
|
||||
withBundleAnalyzer({
|
||||
env: {
|
||||
SENTRY_RELEASE: gitSha,
|
||||
SENTRY_RELEASE: GIT_SHA,
|
||||
},
|
||||
workbox: WORKBOX_CONFIG,
|
||||
|
||||
|
@ -48,5 +51,5 @@ module.exports = withSentryConfig(
|
|||
},
|
||||
})
|
||||
),
|
||||
{ release: gitSha }
|
||||
{ release: GIT_SHA, dryRun: !SENTRY_ENABLED }
|
||||
);
|
||||
|
|
|
@ -1,18 +1,24 @@
|
|||
import * as Sentry from '@sentry/nextjs';
|
||||
import { getSentryTunnelUrl } from 'utils/common/apiUtil';
|
||||
import { getUserAnonymizedID } from 'utils/user';
|
||||
import {
|
||||
getSentryDSN,
|
||||
getSentryENV,
|
||||
getSentryRelease,
|
||||
isSentryEnabled,
|
||||
} from 'constants/sentry';
|
||||
|
||||
const SENTRY_DSN =
|
||||
process.env.NEXT_PUBLIC_SENTRY_DSN ??
|
||||
'https://860186db60c54c7fbacfe255124958e8@errors.ente.io/4';
|
||||
const SENTRY_ENV = process.env.NEXT_PUBLIC_SENTRY_ENV ?? 'development';
|
||||
const SENTRY_DSN = getSentryDSN();
|
||||
const SENTRY_ENV = getSentryENV();
|
||||
const SENTRY_RELEASE = getSentryRelease();
|
||||
const ENABLED = isSentryEnabled();
|
||||
|
||||
Sentry.setUser({ id: getUserAnonymizedID() });
|
||||
Sentry.init({
|
||||
dsn: SENTRY_DSN,
|
||||
enabled: SENTRY_ENV !== 'development',
|
||||
enabled: ENABLED,
|
||||
environment: SENTRY_ENV,
|
||||
release: process.env.SENTRY_RELEASE,
|
||||
release: SENTRY_RELEASE,
|
||||
attachStacktrace: true,
|
||||
autoSessionTracking: false,
|
||||
tunnel: getSentryTunnelUrl(),
|
||||
|
|
|
@ -1,12 +1,20 @@
|
|||
import * as Sentry from '@sentry/nextjs';
|
||||
import {
|
||||
getSentryDSN,
|
||||
getSentryENV,
|
||||
getSentryRelease,
|
||||
isSentryEnabled,
|
||||
} from 'constants/sentry';
|
||||
|
||||
const SENTRY_DSN = process.env.NEXT_PUBLIC_SENTRY_DSN ?? 'https://860186db60c54c7fbacfe255124958e8@errors.ente.io/4';
|
||||
const SENTRY_ENV = process.env.NEXT_PUBLIC_SENTRY_ENV ?? 'development';
|
||||
const SENTRY_DSN = getSentryDSN();
|
||||
const SENTRY_ENV = getSentryENV();
|
||||
const SENTRY_RELEASE = getSentryRelease();
|
||||
const ENABLED = isSentryEnabled();
|
||||
|
||||
Sentry.init({
|
||||
dsn: SENTRY_DSN,
|
||||
enabled: SENTRY_ENV !== 'development',
|
||||
enabled: ENABLED,
|
||||
environment: SENTRY_ENV,
|
||||
release: process.env.SENTRY_RELEASE,
|
||||
release: SENTRY_RELEASE,
|
||||
autoSessionTracking: false,
|
||||
});
|
||||
|
|
10
sentryConfigUtil.js
Normal file
10
sentryConfigUtil.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
module.exports.isSentryEnabled = () => {
|
||||
if (process.env.SENTRY_ENABLED) {
|
||||
return process.env.SENTRY_ENABLED === 'yes';
|
||||
} else {
|
||||
if (process.env.NEXT_PUBLIC_SENTRY_ENV) {
|
||||
return process.env.NEXT_PUBLIC_SENTRY_ENV !== 'development';
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
10
src/constants/sentry/index.ts
Normal file
10
src/constants/sentry/index.ts
Normal file
|
@ -0,0 +1,10 @@
|
|||
export const getSentryDSN = () =>
|
||||
process.env.NEXT_PUBLIC_SENTRY_DSN ??
|
||||
'https://860186db60c54c7fbacfe255124958e8@errors.ente.io/4';
|
||||
|
||||
export const getSentryENV = () =>
|
||||
process.env.NEXT_PUBLIC_SENTRY_ENV ?? 'development';
|
||||
|
||||
export const getSentryRelease = () => process.env.SENTRY_RELEASE;
|
||||
|
||||
export { isSentryEnabled } from '../../../sentryConfigUtil';
|
Loading…
Reference in a new issue