Skip to content

Commit 34dc8a6

Browse files
committed
chore: Generalize.
1 parent 83f3cf7 commit 34dc8a6

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

api-docs/scripts/generate-openapi-articles.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ const fs = require('fs');
44
const openapiDocs = require('./openapi-docs/index.js');
55

66
// Calculate the relative paths
7-
const DOCS_ROOT = '.';
8-
const API_DOCS_ROOT = 'api-docs';
7+
const DOCS_ROOT = process.env.DOCS_ROOT || '.';
98

109
// Function to execute shell commands
1110
const execCommand = (command) => {
@@ -61,20 +60,20 @@ const config = {
6160
apis: [
6261
{
6362
name: 'cloud-v2',
64-
spec_file: path.join(API_DOCS_ROOT, '/cloud/v2/ref.yml'),
63+
spec_file: path.join(DOCS_ROOT, '/api-docs/cloud/v2/ref.yml'),
6564
pages_dir: path.join(DOCS_ROOT, '/content/influxdb/cloud/api/v2'),
6665
},
6766
{
6867
name: 'oss-v2',
69-
spec_file: path.join(API_DOCS_ROOT, '/v2/ref.yml'),
68+
spec_file: path.join(DOCS_ROOT, '/api-docs/v2/ref.yml'),
7069
pages_dir: path.join(DOCS_ROOT, '/content/influxdb/v2/api/v2'),
7170
}
7271
]
7372
}
7473

7574
config.apis.forEach(api => {
7675
// Execute the getswagger.sh script
77-
execCommand(`${path.join(API_DOCS_ROOT, 'getswagger.sh')} ${api.name} -B`);
76+
execCommand(`${path.join(DOCS_ROOT, '/api-docs/getswagger.sh')} ${api.name} -B`);
7877
const dataOut = path.join(config.dataOutPath, api.name);
7978
const metadataOut = path.join(config.metadataOutPath, api.name);
8079
if (!fs.existsSync(dataOut)) {

0 commit comments

Comments
 (0)