提交 15166754 编写于 作者: F Fatih Acet

Merge branch 'implement-cert-key-pair' into 'master'

Implement cert key pair

See merge request fatihacet/gitlab-vscode-extension!29
......@@ -185,6 +185,16 @@
"default": null,
"description": "Custom CA file to use (example: /etc/ssl/certs/ca-certificates.crt)"
},
"gitlab.cert": {
"type": "string",
"default": null,
"description": "Custom Certificate file to use (example: /etc/ssl/certs/certificate.crt)"
},
"gitlab.certKey": {
"type": "string",
"default": null,
"description": "Custom Certificate Key file to use (example: /etc/ssl/certs/certificateKey.key)"
},
"gitlab.ignoreCertificateErrors": {
"type": "boolean",
"default": false,
......
......@@ -10,7 +10,7 @@ let version = null;
let branchMR = null;
async function fetch(path, method = 'GET', data = null) {
const { instanceUrl, ignoreCertificateErrors, ca } = vscode.workspace.getConfiguration('gitlab');
const { instanceUrl, ignoreCertificateErrors, ca, cert, certKey } = vscode.workspace.getConfiguration('gitlab');
const { proxy } = vscode.workspace.getConfiguration('http');
const apiRoot = `${instanceUrl}/api/v4`;
const glToken = tokenService.getToken(instanceUrl);
......@@ -42,6 +42,22 @@ async function fetch(path, method = 'GET', data = null) {
}
}
if (cert) {
try {
config.cert = fs.readFileSync(cert);
} catch (e) {
vscode.window.showErrorMessage(`GitLab Workflow: Cannot read CA '${cert}'`);
}
}
if (certKey) {
try {
config.key = fs.readFileSync(certKey);
} catch (e) {
vscode.window.showErrorMessage(`GitLab Workflow: Cannot read CA '${certKey}'`);
}
}
if (data) {
config.formData = data;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册