tools/PTE/pte-util.js
// if key is missing or invalid, set the pointer to the beginning of the File
if key is missing or invalid, set the pointer to the beginning of the File
if key is missing or invalid set the pointer to the beginning of the File
function readConfigFile(inFile, keyreq) {
    var temp;
    var file_ext = path.extname(inFile);
    logger.debug('[readConfigFile] input File: ', inFile);
    if ((/(yml|yaml)$/i).test(file_ext)) {
        temp = yaml.safeLoad(fs.readFileSync(inFile, 'utf8'));
    } else {
        temp = JSON.parse(fs.readFileSync(inFile));
    }
    if (temp[keyreq]) {
        logger.debug('[readConfigFile] set pointer to %s[%s] ', inFile, keyreq);
        return temp[keyreq];
    } else {
        logger.debug('[readConfigFile] set pointer to %s', inFile);
        return temp;
    }
}
function readConfigFile ( inFile , keyreq ) { var temp ; var file_ext = path . extname ( inFile ) ; logger . debug ( '[readConfigFile] input File: ' , inFile ) ; if ( ( / (yml|yaml)$ / i ) . test ( file_ext ) ) { temp = yaml . safeLoad ( fs . readFileSync ( inFile , 'utf8' ) ) ; } else { temp = JSON . parse ( fs . readFileSync ( inFile ) ) ; } if ( temp [ keyreq ] ) { logger . debug ( '[readConfigFile] set pointer to %s[%s] ' , inFile , keyreq ) ; return temp [ keyreq ] ; } else { logger . debug ( '[readConfigFile] set pointer to %s' , inFile ) ; return temp ; } }
if key is missing or invalid, set the pointer to the beginning of the File
if key is missing or invalid set the pointer to the beginning of the File