mirror of
https://github.com/vale981/Vulcan
synced 2025-03-04 17:21:37 -05:00
Make sourceVersion a function
This commit is contained in:
parent
46bdfe0f57
commit
466cb7d0a6
3 changed files with 17 additions and 5 deletions
|
@ -1,4 +1,4 @@
|
|||
import { getSetting, sourceVersion } from 'meteor/vulcan:core';
|
||||
import { getSetting, getSourceVersion } from 'meteor/vulcan:core';
|
||||
import { addInitFunction, addLogFunction, addUserFunction } from 'meteor/vulcan:errors';
|
||||
import { serverDSNSetting } from '../modules/settings';
|
||||
import Sentry from '@sentry/node';
|
||||
|
@ -17,7 +17,7 @@ function initSentryForServer() {
|
|||
dsn: serverDSN,
|
||||
environment,
|
||||
// see https://github.com/zodern/meteor-up/issues/807#issuecomment-346915622
|
||||
release: sourceVersion,
|
||||
release: getSourceVersion(),
|
||||
});
|
||||
}
|
||||
addInitFunction(initSentryForServer);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { addGraphQLSchema, addGraphQLResolvers, addGraphQLQuery } from '../modules/graphql.js';
|
||||
import { Utils } from '../modules/utils';
|
||||
import { getSetting } from '../modules/settings.js';
|
||||
import { sourceVersion } from './source_version.js';
|
||||
import { getSourceVersion } from './source_version.js';
|
||||
|
||||
const siteSchema = `type Site {
|
||||
title: String
|
||||
|
@ -18,7 +18,7 @@ const siteResolvers = {
|
|||
title: getSetting('title'),
|
||||
url: getSetting('siteUrl', Meteor.absoluteUrl()),
|
||||
logoUrl: Utils.getLogoUrl(),
|
||||
sourceVersion,
|
||||
sourceVersion: getSourceVersion(),
|
||||
};
|
||||
},
|
||||
},
|
||||
|
|
|
@ -8,4 +8,16 @@ or current child process.
|
|||
See https://github.com/zodern/meteor-up/issues/807#issuecomment-346915622
|
||||
|
||||
*/
|
||||
export const sourceVersion = process.env.SOURCE_VERSION || childProcess.execSync('git rev-parse HEAD').toString().trim();
|
||||
export const getSourceVersion = () => {
|
||||
try {
|
||||
return (
|
||||
process.env.SOURCE_VERSION ||
|
||||
childProcess
|
||||
.execSync('git rev-parse HEAD')
|
||||
.toString()
|
||||
.trim()
|
||||
);
|
||||
} catch (error) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue