Commit 4dc9d9c4 by xiaolanchong

sentry

parent 84c77940
const packageEnv = require('./package.json');
export const BASE_URL = '/live';
export const X_CA_STAGE = process.env.X_CA_STAGE || ''; // TEST PRE ''
export const BUILD_DIST = process.env.X_CA_STAGE || 'PROD'; // TEST PRE PROD
/* sentry */
function getEnv() {
let env = process.env.VUE_APP_X_CA_STAGE;
let environment = '';
switch (env) {
case 'TEST':
environment = 'development';
break;
case 'PRE':
environment = 'preview';
break;
case '':
environment = 'production';
break;
default:
environment = 'production';
break;
}
return environment;
}
export const sentryOptions = {
dsn: `https://2fdea25b53284316bae9eadd5206164c@sentry.guangdianyun.tv/20`,
version: packageEnv.version,
env: getEnv(),
name: packageEnv.name
};
export default function(context) {
context.userAgent = process.server
? context.req.headers["user-agent"]
: navigator.userAgent;
context.userAgent = process.server ? context.req.headers['user-agent'] : navigator.userAgent;
}
const BASE_URL = '/live/';
const X_CA_STAGE = process.env.X_CA_STAGE || ''; // TEST PRE PROD
const BUILD_DIST = process.env.X_CA_STAGE || 'PROD';
const WebpackAliOSSPlugin = require('webpack-oss');
const time = WebpackAliOSSPlugin.getFormat('YYMMDD');
const path = require('path');
import { BASE_URL, X_CA_STAGE, BUILD_DIST, sentryOptions } from './config';
export default {
buildDir: 'nuxt-dist',
......@@ -78,7 +75,7 @@ export default {
** Nuxt.js modules
*/
modules: [
// Doc: https://axios.nuxtjs.org/usage
'@nuxtjs/sentry',
'@nuxtjs/axios',
[
'@nuxtjs/component-cache',
......@@ -88,11 +85,10 @@ export default {
}
]
],
axios: {},
/*
** Axios module configuration
** See https://axios.nuxtjs.org/options
*/
sentry: {
dsn: sentryOptions.dsn,
config: {}
},
server: {
port: 3000, // default: 3000
host: '0.0.0.0' // default: localhost
......
......@@ -24,13 +24,14 @@
"dependencies": {
"@nuxtjs/axios": "^5.3.6",
"@nuxtjs/component-cache": "^1.1.5",
"@nuxtjs/sentry": "^4.1.2",
"alife-logger": "^1.8.3",
"clipboard": "^2.0.6",
"cookieparser": "^0.1.0",
"cross-env": "^6.0.3",
"js-cookie": "^2.2.0",
"js-md5": "^0.7.3",
"nuxt": "2.10.2",
"nuxt": "^2.10.2",
"swiper": "^4.5.0",
"vue-lazyload": "^1.3.3",
"vue-photoswipe.js": "^2.0.16",
......
......@@ -4,11 +4,11 @@
</div>
</template>
<script>
const state404 = resolve => require(["@/components/state/404"], resolve);
const state404 = resolve => require(['@/components/state/404'], resolve);
export default {
head() {
return {
title: "抱歉,您的页面迷路了"
title: '抱歉,您的页面迷路了'
};
},
components: {
......
......@@ -4,6 +4,7 @@
</template>
<script>
import { mapGetters, mapMutations, mapActions } from 'vuex';
import REPORT from '@/plugins/report';
import DMS from '@/plugins/Mixin/dms';
import UserAgent from '@/plugins/UserAgent/index';
const state = resolve => require(['@/components/state/index'], resolve);
......@@ -43,9 +44,10 @@ export default {
}
}
},
async asyncData({ store, query, params, userAgent }) {
async asyncData({ store, query, params, userAgent, $sentry }) {
let isMobile = !!/Android|webOS|iPhone|iPod|BlackBerry/i.test(userAgent);
let mobile = Number(query.mobile);
REPORT($sentry, { AppId: params.id, Uin: query.uin });
await store.dispatch('get_control', { id: params.id });
return {
isMobile: mobile || isMobile
......@@ -53,6 +55,8 @@ export default {
},
mixins: [DMS],
async mounted() {
let { id, uin } = this.channelInfo;
REPORT(this.$sentry, { AppId: id, Uin: uin });
let mobile = Number(this.$route.query.mobile);
this.isMobile = mobile || UserAgent.isMobile();
this.set_corpId(Number(this.$route.query.corpId));
......
......@@ -276,6 +276,7 @@ const mixin = {
}
return false;
}
console.log(data);
if (data.cmd === 'deleteShop') {
this.$Bus.$emit('bus-delShop', data);
return false;
......
import { sentryOptions } from '@/config';
const report = ($sentry, { AppId, Uin }) => {
$sentry.setTag('Package', sentryOptions.version);
$sentry.setTag('AppId', AppId);
$sentry.setTag('Uin', Uin);
$sentry.setUser({
AppId: AppId,
Uin: Uin,
Name: sentryOptions.name,
Environment: sentryOptions.env
});
};
export default report;
#!/bin/sh
/etc/init.d/zabbix_agentd start
/etc/init.d/zabbix_agentd start && \
npm config set scripts-prepend-node-path true && \
yarn run pm2
while true
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment