2019-10-24 17:11:12 +02:00
|
|
|
"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:
|
2019-10-25 10:54:08 +02:00
|
|
|
parseInt(process.env.PROSTOR_MAX_RESULTS_PER_PAGE) || 5000,
|
2019-10-24 17:11:12 +02:00
|
|
|
PROSTOR_CRAWLER_AD_TYPE: prostorCrawlerAdType || CRAWLER_AD_TYPE.NONE,
|
|
|
|
|
PROSTOR_CRAWLER_AD_CATEGORIES: transformedProstorCrawlerAdCategories,
|
|
|
|
|
PROSTOR_IGNORED_USERNAMES: prostorIgnoredUsernames || [],
|
|
|
|
|
PROSTOR_DELAY_BETWEEN_PAGES:
|
2019-11-13 16:54:16 +01:00
|
|
|
parseInt(process.env.PROSTOR_DELAY_BETWEEN_PAGES) || 1000,
|
|
|
|
|
PROSTOR_FORCE_CRAWL: !!parseInt(process.env.PROSTOR_FORCE_CRAWL)
|
2019-10-24 17:11:12 +02:00
|
|
|
};
|