"use strict"; const { CRAWLER_AD_TYPE, AD_CATEGORY } = require("../../common/enums"); const prostorCrawlerAdType = process.env.PROSTOR_CRAWLER_AD_TYPE !== undefined ? CRAWLER_AD_TYPE[process.env.PROSTOR_CRAWLER_AD_TYPE] : null; const prostorParsedCrawlerAdCategories = process.env.PROSTOR_CRAWLER_AD_CATEGORIES !== undefined ? process.env.PROSTOR_CRAWLER_AD_CATEGORIES.split(",").map(category => category.trim() ) : ["FLAT", "HOUSE"]; const prostorIgnoredUsernames = []; const transformedProstorCrawlerAdCategories = prostorParsedCrawlerAdCategories .map(categoryName => AD_CATEGORY[categoryName] ? AD_CATEGORY[categoryName].id : undefined ) .filter(category => !!category); module.exports = { PROSTOR_MAX_PAGES: parseInt(process.env.PROSTOR_MAX_PAGES) || 100, PROSTOR_MAX_RESULTS_PER_PAGE: parseInt(process.env.PROSTOR_MAX_RESULTS_PER_PAGE) || 5000, PROSTOR_CRAWLER_AD_TYPE: prostorCrawlerAdType || CRAWLER_AD_TYPE.NONE, PROSTOR_CRAWLER_AD_CATEGORIES: transformedProstorCrawlerAdCategories, PROSTOR_IGNORED_USERNAMES: prostorIgnoredUsernames || [], PROSTOR_DELAY_BETWEEN_PAGES: parseInt(process.env.PROSTOR_DELAY_BETWEEN_PAGES) || 1000, PROSTOR_FORCE_CRAWL: !!parseInt(process.env.PROSTOR_FORCE_CRAWL) };