-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdumpContentful.js
More file actions
32 lines (27 loc) · 808 Bytes
/
dumpContentful.js
File metadata and controls
32 lines (27 loc) · 808 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
require('dotenv').config();
const stagingSpaceId = process.env.ORIGIN_SPACE_ID;
const productionSpaceId = process.env.TARGET_SPACE_ID;
const managementToken = process.env.MANAGEMENT_TOKEN;
const spaceExport = require('contentful-export');
const stagingSpaceOpts = {
spaceId: stagingSpaceId,
managementToken: managementToken,
maxAllowedItems: 10000,
skipRoles: true
}
const productionSpaceOpts = {
spaceId: productionSpaceId,
managementToken: managementToken,
maxAllowedItems: 10000,
skipRoles: true
}
const dumpContentful = () => {
console.log('Beginning dump of Contentful...')
return spaceExport(stagingSpaceOpts)
.then( (res) => spaceExport(productionSpaceOpts) )
.catch( (err) => {
console.error('error!');
console.error(err);
});
}
module.exports = dumpContentful;