refactor: move mappingIgnoredTags into config file

This commit is contained in:
Wieland Schöbl
2019-09-26 11:09:57 +02:00
committed by Rainer Killinger
parent 13938ecf21
commit 4ac6987813
3 changed files with 4 additions and 5 deletions

View File

@@ -20,15 +20,13 @@ import {Client} from 'elasticsearch';
import {existsSync, writeFileSync} from 'fs';
import {readFile} from 'fs-extra';
import {resolve} from 'path';
import {coreVersion} from '../../common';
import {configFile, coreVersion} from '../../common';
const dirPath = resolve('src', 'storage', 'elasticsearch', 'templates');
const templatePath = resolve(dirPath, `template_${coreVersion}.json`);
const errorPath = resolve(dirPath, `failed_template_${coreVersion}.json`);
const errorReportPath = resolve(dirPath, `error_report_${coreVersion}.txt`);
const ignoredTags = ['minlength', 'pattern', 'see', 'tjs-format']; // TODO: put this into config
/**
* Check if the correct template exists
*/
@@ -41,7 +39,7 @@ export function checkESTemplate(forceUpdate: boolean) {
Logger.info(`No mapping for Core version ${coreVersion} found, starting automatic mapping generation. ` +
`This may take a while.`);
const map = generateTemplate(getProjectReflection(resolve('node_modules', '@openstapps', 'core', 'src')),
ignoredTags, false);
configFile.backend.mappingIgnoredTags, false);
if (map.errors.length > 0) {
// tslint:disable-next-line:no-magic-numbers