如何解决无法将证书路径放入 antora-playbook.yml
这是我的文档项目中 antora-playbook.yml 的内容:
runtime:
cache_dir: ./.cache/antora
site:
title: Dokumentation "My App"
start_page: component-a::index.adoc
content:
sources:
- url: https://gitlab.x.info/myapp/app.git
branches: asciidoc-GitLab
start_path: docs
asciidoc:
attributes:
experimental: ''
idprefix: ''
idseparator: '-'
page-pagination: ''
source-language: asciidoc@
ui:
bundle:
url: https://gitlab.com/antora/antora-ui-default/-/jobs/artifacts/master/raw/build/ui-bundle.zip?
job=bundle-stable
snapshot: true
不可能包含 gitlab 证书,例如:
git:
ca:
path:C:\path_to_cert.crt
它也不适用于系统环境变量:
NODE_EXTRA_CA_CERTS=C:\cert.crt
那么,我如何将证书放入 antora-playbook.yml 或我的文档项目中的任何其他位置?现在,当使用命令时,所有结果都以 400 错误告终: antora antora-playbook.yml
解决方法
好的,有一个解决方案: 创建一个 .js 文件,即带有内容的 app.js:
const https = require('https');
const fs = require('fs');
const axios = require("axios");
const { exec } = require("child_process")
const httpsAgent = new https.Agent({
port: 1234,key: fs.readFileSync("C:\\cert.pem"),cert: fs.readFileSync("C:\\cert.crt"),pfx: fs.readFileSync('C:\\cert.pfx'),passphrase: 'password',form: {
//credentials GitLab
username: "username",password: "password"
}
})
axios.get('https://gitlab.x.info/users/sign_in',{
httpsAgent
}).then(res=>{
console.log(res.status)
**exec("npm run-script antora")**
}).catch(res=> {
console.log(res)
})
并在 json 包中放入:
"scripts": {
"antora": "antora antora-playbook.yml"
}
这是一种方法。可能还有其他方法可以让它发挥作用。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。