Hide stderr git output during APM agent configuration (#52878)

This commit is contained in:
Thomas Watson 2019-12-12 16:00:07 +01:00 committed by GitHub
parent 45563b2574
commit f8ba2fdd78
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -42,19 +42,22 @@ const { join } = require('path');
const { execSync } = require('child_process'); const { execSync } = require('child_process');
const merge = require('lodash.merge'); const merge = require('lodash.merge');
module.exports = merge({ module.exports = merge(
active: false, {
serverUrl: 'https://f1542b814f674090afd914960583265f.apm.us-central1.gcp.cloud.es.io:443', active: false,
// The secretToken below is intended to be hardcoded in this file even though serverUrl: 'https://f1542b814f674090afd914960583265f.apm.us-central1.gcp.cloud.es.io:443',
// it makes it public. This is not a security/privacy issue. Normally we'd // The secretToken below is intended to be hardcoded in this file even though
// instead disable the need for a secretToken in the APM Server config where // it makes it public. This is not a security/privacy issue. Normally we'd
// the data is transmitted to, but due to how it's being hosted, it's easier, // instead disable the need for a secretToken in the APM Server config where
// for now, to simply leave it in. // the data is transmitted to, but due to how it's being hosted, it's easier,
secretToken: 'R0Gjg46pE9K9wGestd', // for now, to simply leave it in.
globalLabels: {}, secretToken: 'R0Gjg46pE9K9wGestd',
centralConfig: false, globalLabels: {},
logUncaughtExceptions: true centralConfig: false,
}, devConfig()); logUncaughtExceptions: true,
},
devConfig()
);
const rev = gitRev(); const rev = gitRev();
if (rev !== null) module.exports.globalLabels.git_rev = rev; if (rev !== null) module.exports.globalLabels.git_rev = rev;
@ -66,7 +69,10 @@ try {
function gitRev() { function gitRev() {
try { try {
return execSync('git rev-parse --short HEAD', { encoding: 'utf-8' }).trim(); return execSync('git rev-parse --short HEAD', {
encoding: 'utf-8',
stdio: ['ignore', 'pipe', 'ignore'],
}).trim();
} catch (e) { } catch (e) {
return null; return null;
} }