mirror of
https://github.com/opelly27/streetmerchant.git
synced 2026-05-20 05:17:35 +00:00
feat: support for proxy server (#352)
Co-authored-by: Adrian Martin <adrian.martin@nbcuni.com>
This commit is contained in:
@@ -28,6 +28,8 @@ PAGE_BACKOFF_MIN=""
|
|||||||
PAGE_BACKOFF_MAX=""
|
PAGE_BACKOFF_MAX=""
|
||||||
PAGE_SLEEP_MIN=""
|
PAGE_SLEEP_MIN=""
|
||||||
PAGE_SLEEP_MAX=""
|
PAGE_SLEEP_MAX=""
|
||||||
|
PROXY_ADDRESS=""
|
||||||
|
PROXY_PORT=""
|
||||||
SHOW_ONLY_BRANDS=""
|
SHOW_ONLY_BRANDS=""
|
||||||
SHOW_ONLY_MODELS=""
|
SHOW_ONLY_MODELS=""
|
||||||
SHOW_ONLY_SERIES=""
|
SHOW_ONLY_SERIES=""
|
||||||
|
|||||||
@@ -95,6 +95,8 @@ Here is a list of variables that you can use to customize your newly copied `.en
|
|||||||
| `PAGE_BACKOFF_MAX` | Maximum backoff time between retrying requests for the same store when a forbidden response is received | Default: `3600000` |
|
| `PAGE_BACKOFF_MAX` | Maximum backoff time between retrying requests for the same store when a forbidden response is received | Default: `3600000` |
|
||||||
| `PAGE_SLEEP_MIN` | Minimum sleep time between queries of the same store | In milliseconds, default: `5000` |
|
| `PAGE_SLEEP_MIN` | Minimum sleep time between queries of the same store | In milliseconds, default: `5000` |
|
||||||
| `PAGE_SLEEP_MAX` | Maximum sleep time between queries of the same store | In milliseconds, default: `10000` |
|
| `PAGE_SLEEP_MAX` | Maximum sleep time between queries of the same store | In milliseconds, default: `10000` |
|
||||||
|
| `PROXY_ADDRESS` | IP Address or fqdn of proxy server |
|
||||||
|
| `PROXY_PORT` | TCP Port number on which the proxy is listening for connections | Default: `80` |
|
||||||
| `SCREENSHOT` | Capture screenshot of page if a card is found | Default: `true` |
|
| `SCREENSHOT` | Capture screenshot of page if a card is found | Default: `true` |
|
||||||
| `SHOW_ONLY_BRANDS` | Filter to show specified brands | Comma separated, e.g.: `evga,zotac` |
|
| `SHOW_ONLY_BRANDS` | Filter to show specified brands | Comma separated, e.g.: `evga,zotac` |
|
||||||
| `SHOW_ONLY_MODELS` | Filter to show specified models | Comma separated, e.g.: `founders edition,rog strix` |
|
| `SHOW_ONLY_MODELS` | Filter to show specified models | Comma separated, e.g.: `founders edition,rog strix` |
|
||||||
|
|||||||
@@ -133,6 +133,11 @@ const page = {
|
|||||||
width: 1920
|
width: 1920
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const proxy = {
|
||||||
|
address: envOrString(process.env.PROXY_ADDRESS, ''),
|
||||||
|
port: envOrNumber(process.env.PROXY_PORT, 80)
|
||||||
|
};
|
||||||
|
|
||||||
const store = {
|
const store = {
|
||||||
country: envOrString(process.env.COUNTRY, 'usa'),
|
country: envOrString(process.env.COUNTRY, 'usa'),
|
||||||
microCenterLocation: envOrString(process.env.MICROCENTER_LOCATION, 'web'),
|
microCenterLocation: envOrString(process.env.MICROCENTER_LOCATION, 'web'),
|
||||||
@@ -148,5 +153,6 @@ export const Config = {
|
|||||||
notifications,
|
notifications,
|
||||||
nvidia,
|
nvidia,
|
||||||
page,
|
page,
|
||||||
|
proxy,
|
||||||
store
|
store
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -36,6 +36,11 @@ async function main() {
|
|||||||
args.push('--disable-setuid-sandbox');
|
args.push('--disable-setuid-sandbox');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add the address of the proxy server if defined
|
||||||
|
if (Config.proxy.address) {
|
||||||
|
args.push(`--proxy-server=http://${Config.proxy.address}:${Config.proxy.port}`);
|
||||||
|
}
|
||||||
|
|
||||||
const browser = await puppeteer.launch({
|
const browser = await puppeteer.launch({
|
||||||
args,
|
args,
|
||||||
defaultViewport: {
|
defaultViewport: {
|
||||||
|
|||||||
Reference in New Issue
Block a user