Skip to content
This repository has been archived by the owner on Oct 5, 2024. It is now read-only.

Commit

Permalink
Merge pull request #327 from dotkom/fix/raven-release
Browse files Browse the repository at this point in the history
Allow Sentry to track releases
  • Loading branch information
sklirg authored Mar 5, 2018
2 parents 4d20161 + a3dafe5 commit 35dc1da
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server/channels/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ const {
} = require('../../common/actionTypes/voting');
const { RECEIVE_USER_LIST: USER_LIST } = require('../../common/actionTypes/users');
const { VOTING_FINISHED } = require('../../common/actionTypes/issues');
const { getGitSha } = require('../utils/git');

// eslint-disable-next-line global-require
const APP_VERSION = require('child_process').execSync('git rev-parse HEAD').toString().trim();
const APP_VERSION = getGitSha();

const emitUserData = async (socket) => {
emit(socket, VERSION, { version: APP_VERSION });
Expand Down
2 changes: 2 additions & 0 deletions server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const appConfig = require('./app');
const channels = require('./channels/index');
const logger = require('./logging');
const Raven = require('raven');
const { getGitSha } = require('./utils/git');

(async () => {
const app = await appConfig();
Expand All @@ -18,6 +19,7 @@ const Raven = require('raven');
tags: {
app: 'backend',
},
release: getGitSha(),
})
.install();

Expand Down
9 changes: 9 additions & 0 deletions server/utils/git.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const childProcess = require('child_process');

function getGitSha() {
return childProcess.execSync('git rev-parse HEAD').toString().trim();
}

module.exports = {
getGitSha,
};

0 comments on commit 35dc1da

Please sign in to comment.