mirror of
https://github.com/certd/certd.git
synced 2025-11-25 09:10:11 +08:00
🔱: [acme] sync upgrade with 21 commits [trident-sync]
Bump v5.0.0
This commit is contained in:
40
packages/core/acme-client/src/axios.js
Normal file
40
packages/core/acme-client/src/axios.js
Normal file
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* Axios instance
|
||||
*/
|
||||
|
||||
const axios = require('axios');
|
||||
const adapter = require('axios/lib/adapters/http');
|
||||
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,
|
||||
bypassCustomDnsResolver: false
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Explicitly set Node as default HTTP adapter
|
||||
*
|
||||
* https://github.com/axios/axios/issues/1180
|
||||
* https://stackoverflow.com/questions/42677387
|
||||
*/
|
||||
|
||||
instance.defaults.adapter = adapter;
|
||||
|
||||
|
||||
/**
|
||||
* Export instance
|
||||
*/
|
||||
|
||||
module.exports = instance;
|
||||
Reference in New Issue
Block a user