提交 5ba4b5f3 authored 作者: 王鹏飞's avatar 王鹏飞

chore: 新增更新https证书的脚本

上级 8252285b
const fs = require('fs')
const path = require('path')
const axios = require('axios')
const domain = 'ezijing.com'
const outputPath = './https'
// 生成文件夹
function genOutputDir() {
if (fs.existsSync(outputPath)) {
console.log('The path exists.')
} else {
fs.mkdir(outputPath, { recursive: true }, err => {
if (err) throw err
})
}
}
function downloadCertFile() {
genOutputDir()
axios.get(`https://ssl.godzyx.com/${domain}/${domain}.key?get=allow`, { responseType: 'stream' }).then(response => {
response.data.pipe(fs.createWriteStream(path.join(__dirname, `${outputPath}/${domain}.key`)))
})
axios.get(`https://ssl.godzyx.com/${domain}/${domain}.pem?get=allow`, { responseType: 'stream' }).then(response => {
response.data.pipe(fs.createWriteStream(path.join(__dirname, `${outputPath}/${domain}.pem`)))
})
}
downloadCertFile()
......@@ -7,6 +7,7 @@
"build:test": "vite build --mode test",
"preview": "vite preview",
"deploy": "node ./deploy.js",
"cert": "node ./cert.js",
"lint": "eslint --ext .js,.vue --ignore-path .gitignore --fix src"
},
"dependencies": {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论