未验证 提交 b52fbb4c 编写于 作者: A Asher

Catch error when openssl isn't installed

上级 3463d561
Subproject commit ae08d5460b5a45169385ff3fd44208f431992451
Subproject commit 78a4c91400152c0f27ba4d363eb56d2835f9903a
......@@ -45,11 +45,16 @@ const main = async (args: Args): Promise<void> => {
} else if (args.cert && !args["cert-key"]) {
throw new Error("--cert-key is missing")
}
if (!args["disable-ssh"]) {
if (!options.sshHostKey && typeof options.sshHostKey !== "undefined") {
throw new Error("--ssh-host-key cannot be blank")
} else if (!options.sshHostKey) {
options.sshHostKey = await generateSshHostKey()
try {
options.sshHostKey = await generateSshHostKey()
} catch (error) {
logger.error("Unable to start SSH server", field("error", error.message))
}
}
}
......@@ -66,7 +71,7 @@ const main = async (args: Args): Promise<void> => {
logger.info(`code-server ${require("../../package.json").version}`)
let sshPort = ""
if (!args["disable-ssh"]) {
if (!args["disable-ssh"] && options.sshHostKey) {
const sshProvider = httpServer.registerHttpProvider("/ssh", SshProvider, options.sshHostKey as string)
sshPort = await sshProvider.listen()
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册