2023-01-29 15:27:11 +08:00
|
|
|
/**
|
|
|
|
|
* Axios instance
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
const axios = require('axios');
|
|
|
|
|
const pkg = require('./../package.json');
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Instance
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
const instance = axios.create();
|
|
|
|
|
|
|
|
|
|
/* Default User-Agent */
|
|
|
|
|
instance.defaults.headers.common['User-Agent'] = `node-${pkg.name}/${pkg.version}`;
|
|
|
|
|
|
|
|
|
|
/* Default ACME settings */
|
|
|
|
|
instance.defaults.acmeSettings = {
|
|
|
|
|
httpChallengePort: 80,
|
2024-01-30 19:24:20 +00:00
|
|
|
httpsChallengePort: 443,
|
2024-05-22 19:24:07 +00:00
|
|
|
tlsAlpnChallengePort: 443,
|
2023-01-29 15:27:11 +08:00
|
|
|
};
|
2024-03-06 18:36:10 +08:00
|
|
|
// instance.defaults.proxy = {
|
|
|
|
|
// host: '192.168.34.139',
|
|
|
|
|
// port: 10811
|
|
|
|
|
// };
|
2023-01-29 15:27:11 +08:00
|
|
|
/**
|
|
|
|
|
* Explicitly set Node as default HTTP adapter
|
|
|
|
|
*
|
|
|
|
|
* https://github.com/axios/axios/issues/1180
|
|
|
|
|
* https://stackoverflow.com/questions/42677387
|
|
|
|
|
*/
|
|
|
|
|
|
2024-01-20 19:24:14 +00:00
|
|
|
instance.defaults.adapter = 'http';
|
2023-01-29 15:27:11 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Export instance
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
module.exports = instance;
|