feat: disabled server authorization in dev mode according to https://stackoverflow.com/questions/51363855/how-to-configure-axios-to-use-ssl-certificate
This commit is contained in:
parent
06abf48a86
commit
ab878373f3
18
index.js
18
index.js
|
@ -11,6 +11,18 @@ debug('USR: '+USR)
|
|||
const KEY=process.env.KEY||'KEY';
|
||||
debug('KEY: '+KEY)
|
||||
|
||||
/**
|
||||
* Disable server authorization only in development mode
|
||||
*/
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
const https = require('https');
|
||||
const httpsAgent = new https.Agent({
|
||||
rejectUnauthorized: false,
|
||||
})
|
||||
axios.defaults.httpsAgent = httpsAgent
|
||||
debug('%s RejectUnauthorized is disabled.',process.env.NODE_ENV)
|
||||
}
|
||||
|
||||
run().catch(err => {
|
||||
debug('run: error')
|
||||
console.log(err)
|
||||
|
@ -30,8 +42,10 @@ async function run() {
|
|||
username: `${USR}`,
|
||||
password: `${KEY}`
|
||||
}
|
||||
});
|
||||
res.status; // 200
|
||||
}
|
||||
).then(res => res.data);
|
||||
// );
|
||||
// res.status; // 200
|
||||
|
||||
debug('data received via GET');
|
||||
debug('dataGet len: %s',dataGet.length)
|
||||
|
|
|
@ -4,12 +4,13 @@
|
|||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"dev": "nodemon index.js",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
"dev": "nodemon index.js",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "Stefan Begerad",
|
||||
"license": "GPL-3.0",
|
||||
"devDependencies": {
|
||||
"https": "^1.0.0",
|
||||
"nodemon": "^2.0.7"
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
Loading…
Reference in New Issue