- 37개 파일 IP → zioinfo.co.kr 치환 (소스/매뉴얼/설정/하네스) - Manager DrConsole/NetworkConsole/CsapConsole 빌드 + /var/www/manager/ 배포 - 테스트: Manager HTTP 200, ITSM 신규 API 7개 전체 200 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
35 lines
923 B
JavaScript
35 lines
923 B
JavaScript
const fs = require('fs')
|
|
const path = require('path')
|
|
const { getRefFilePath } = require('../utils')
|
|
|
|
var cwd = process.cwd()
|
|
|
|
/**
|
|
* Resolves a file link of a json schema to the actual value it references
|
|
* @param refValue the value. String. Ex. `/some/path/schema.json#/definitions/foo`
|
|
* @param options
|
|
* baseFolder - the base folder to get relative path files from. Default is `process.cwd()`
|
|
* @returns {*}
|
|
* @private
|
|
*/
|
|
module.exports = function (refValue, options) {
|
|
let refPath = refValue
|
|
const baseFolder = options.baseFolder ? path.resolve(cwd, options.baseFolder) : cwd
|
|
|
|
if (refPath.indexOf('file:') === 0) {
|
|
refPath = refPath.substring(5)
|
|
} else {
|
|
refPath = path.resolve(baseFolder, refPath)
|
|
}
|
|
|
|
const filePath = getRefFilePath(refPath)
|
|
|
|
let newValue
|
|
try {
|
|
var data = fs.readFileSync(filePath)
|
|
newValue = JSON.parse(data)
|
|
} catch (e) {}
|
|
|
|
return newValue
|
|
};
|