tweak: add hardcoded proxy as backup
This commit is contained in:
parent
9bda1c2558
commit
76325bcc48
3
package-lock.json
generated
3
package-lock.json
generated
|
@ -20,7 +20,8 @@
|
|||
"open": "^7.3.1",
|
||||
"papaparse": "^5.3.0",
|
||||
"tabletojson": "^2.0.4",
|
||||
"textversionjs": "^1.1.3"
|
||||
"textversionjs": "^1.1.3",
|
||||
"tunnel": "^0.0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/@algolia/cache-browser-local-storage": {
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"reload": "heroku run:detached node src/utils/doEverythingForScheduler.js",
|
||||
"setCookies": "./src/utils/setCookies.sh"
|
||||
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -37,6 +36,7 @@
|
|||
"open": "^7.3.1",
|
||||
"papaparse": "^5.3.0",
|
||||
"tabletojson": "^2.0.4",
|
||||
"textversionjs": "^1.1.3"
|
||||
"textversionjs": "^1.1.3",
|
||||
"tunnel": "^0.0.6"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,12 +19,20 @@ String.prototype.replaceAll = function replaceAll(search, replace) {
|
|||
/* Body */
|
||||
export async function goodjudgment() {
|
||||
// Proxy fuckery
|
||||
|
||||
let proxy = await axios
|
||||
let proxy;
|
||||
try {
|
||||
proxy = await axios
|
||||
.get("http://pubproxy.com/api/proxy")
|
||||
.then((query) => query.data);
|
||||
console.log(proxy);
|
||||
|
||||
} catch (error) {
|
||||
console.log("Proxy generation failed; using backup proxy instead");
|
||||
// hard-coded backup proxy
|
||||
proxy = {
|
||||
ip: process.env.BACKUP_PROXY_IP,
|
||||
port: process.env.BACKUP_PROXY_PORT,
|
||||
};
|
||||
}
|
||||
let agent = tunnel.httpsOverHttp({
|
||||
proxy: {
|
||||
host: proxy.ip,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
cd /home/loki/Documents/core/software/fresh/js/metaforecasts/metaforecasts-mongo
|
||||
cd /home/loki/Documents/core/software/fresh/js/metaforecast/metaforecast-backend
|
||||
date > done.txt
|
||||
/home/loki/.nvm/versions/node/v16.8.0/bin/node ./src/utils/pullSuperforecastsManually.js >> done.txt
|
||||
|
|
Loading…
Reference in New Issue
Block a user