Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 1 addition & 14 deletions server/app/core/sshManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,6 @@ const { emitAll } = require("../handlers/commUtils.js");

const db = new Map();

/**
* check whether verbose ssh logging is enabled via environment variable
* @returns {boolean} - true when enabled
*/
function isVerboseSshEnabled() {
const value = process.env.WHEEL_VERBOSE_SSH;
if (typeof value !== "string") {
return false;
}
const normalized = value.trim().toLowerCase();
return normalized !== "" && normalized !== "0" && normalized !== "false";
}

/**
* check if db contains ssh object for the project
* @param {string} projectRootDir - project's root path
Expand Down Expand Up @@ -206,7 +193,7 @@ async function createSsh(projectRootDir, remoteHostName, hostinfo, clientID, isS
if (hostinfo.readyTimeout) {
hostinfo.ConnectTimeout = Math.floor(hostinfo.readyTimeout / 1000);
}
if (isVerboseSshEnabled()) {
if (process.env.WHEEL_VERBOSE_SSH) {
hostinfo.sshOpt = ["-vvv"];
}
if (hostinfo.username) {
Expand Down
2 changes: 1 addition & 1 deletion server/app/db/version.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version": "2026-0605-211714" }
{"version": "2026-0316-150937" }
20 changes: 2 additions & 18 deletions server/test/app/core/sshManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,7 @@ describe("#getSshPW", ()=>{
hasEntryMock.returns(true);

//パスワードが関数の場合も想定してテスト
const pwFunc = ()=>{
return "secretFromFunction";
};
const pwFunc = ()=>"secretFromFunction";
dbMock.set("/path/to/project", new Map([
["hostID", { pw: pwFunc }]
]));
Expand Down Expand Up @@ -682,9 +680,7 @@ describe("#createSsh", ()=>{
//ここでは askPasswordMock が呼ばれていない可能性もあります。
//(シナリオによっては、askPasswordMock を実際に呼ばせるには canConnect 内部実装が必要)
//ここでは、"あとで必要になったとき呼ばれる" 想定なので、call回数は 0 のままでも問題なし
expect(askPasswordMock.callCount).to.satisfy((count)=>{
return count === 0 || count === 1;
});
expect(askPasswordMock.callCount).to.satisfy((count)=>count === 0 || count === 1);

expect(result).to.be.ok;
});
Expand Down Expand Up @@ -752,18 +748,6 @@ describe("#createSsh", ()=>{
expect(addSshMock.calledOnce).to.be.true;
});

it("should not set sshOpt when WHEEL_VERBOSE_SSH is false-like", async ()=>{
process.env.WHEEL_VERBOSE_SSH = "false";
hasEntryMock.returns(false);
canConnectMock.resolves(true);

const hostinfo = { id: "verboseFalseTest" };
await createSsh("/vProj", "vHost", hostinfo, "cl-v", false);

expect(hostinfo).to.not.have.property("sshOpt");
expect(addSshMock.calledOnce).to.be.true;
});

it("should copy username to user and remove username if exist", async ()=>{
hasEntryMock.returns(false);
canConnectMock.resolves(true);
Expand Down
Loading