add version to tracking header

This commit is contained in:
Benedikt Rötsch
2017-10-04 17:38:13 +02:00
committed by Benedikt Rötsch
parent cf2101b27b
commit d2493528ae

View File

@@ -4,18 +4,19 @@ let cdaClient = null
let cpaClient = null
exports.initClient = (options) => {
const { version } = require('../package.json')
const config = options || {
space: process.env.CF_SPACE,
cda: process.env.CF_ACCESS_TOKEN,
cpa: process.env.CF_PREVIEW_ACCESS_TOKEN
}
cdaClient = createClient({
application: 'contentful.the-example-app.node',
application: `contentful.the-example-app.node/${version}`,
space: config.space,
accessToken: config.cda
})
cpaClient = createClient({
application: 'contentful.the-example-app.node',
application: `contentful.the-example-app.node/${version}`,
space: config.space,
accessToken: config.cpa,
host: 'preview.contentful.com'