forked from influxdata/docs-v2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocs-content.cjs
More file actions
24 lines (21 loc) · 816 Bytes
/
docs-content.cjs
File metadata and controls
24 lines (21 loc) · 816 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
const path = require('path');
const { toJSON } = require('./helpers/content-helper.cjs');
function getVersioned(filename) {
const apiDocsRoot=path.resolve(process.env.API_DOCS_ROOT_PATH || process.cwd());
let contentPath = path.join(apiDocsRoot, process.env.INFLUXDB_PRODUCT, process.env.INFLUXDB_API_NAME, 'content');
content = toJSON(path.join(contentPath, filename));
if (content) {
return content;
} else {
// If the content is not found in the product/api folder, try the product folder
return toJSON(path.join(apiDocsRoot, process.env.INFLUXDB_PRODUCT, 'content', filename));
}
}
const info = () => getVersioned('info.yml');
const servers = () => getVersioned('servers.yml');
const tagGroups = () => getVersioned('tag-groups.yml');
module.exports = {
info,
servers,
tagGroups,
}