Skip to content

Commit ddcade2

Browse files
committed
KKD-806 - Site data for Redocly - Set file name by environment
1 parent 61b2a97 commit ddcade2

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

helpers/services/redocly.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,23 @@
11
const cacheHandle = require('../cache/handle');
22
const getContent = require('../kontent/getContent');
3+
const isPreview = require('../kontent/isPreview');
34
const getUrlMap = require('../general/urlMap');
45
const github = require('./github');
56

67
const sync = async (res) => {
8+
let prefix = '';
9+
let suffix = '';
10+
11+
if (process.env.IS_DEVELOPMENT === 'true') {
12+
prefix = 'dev_'
13+
}
14+
15+
if (isPreview(res.locals.previewapikey)) {
16+
suffix = '_preview';
17+
}
18+
719
const CACHE_KEY = 'redoclyData';
8-
const FILE_PATH = 'siteData.json';
20+
const FILE_PATH = `${prefix}siteData${suffix}.json`;
921

1022
const KCDetails = getContent.KCDetails(res);
1123
const redoclyDataExisting = cacheHandle.get(CACHE_KEY, KCDetails);

0 commit comments

Comments
 (0)