diff --git a/packages/server/src/services/hermes/file-provider.ts b/packages/server/src/services/hermes/file-provider.ts index aad1129..eb80ec1 100644 --- a/packages/server/src/services/hermes/file-provider.ts +++ b/packages/server/src/services/hermes/file-provider.ts @@ -61,6 +61,7 @@ export interface TerminalConfig { docker_container_name?: string cwd?: string singularity_image?: string + ssh_port?: number } /** @@ -421,18 +422,20 @@ export class SSHFileProvider implements FileProvider { private host: string private user: string private keyPath?: string + private port?: number private homeDir: string - constructor(host: string, user: string, keyPath?: string, homeDir = getActiveProfileDir()) { + constructor(host: string, user: string, keyPath?: string, homeDir = getActiveProfileDir(), port?: number) { this.host = host this.user = user this.keyPath = keyPath + this.port = port this.homeDir = homeDir } private sshArgs(): string[] { - // StrictHostKeyChecking disabled for automated tooling with user-configured hosts const args = ['-o', 'StrictHostKeyChecking=no', '-o', 'BatchMode=yes'] + if (this.port) args.push('-p', String(this.port)) if (this.keyPath) args.push('-i', this.keyPath) args.push(`${this.user}@${this.host}`) return args @@ -740,7 +743,7 @@ export function getTerminalConfig(profile?: string): TerminalConfig { /** * Read SSH env vars from hermes .env file. */ -function getSSHEnvVars(profile?: string): { host?: string; user?: string; key?: string } { +function getSSHEnvVars(profile?: string): { host?: string; user?: string; key?: string; port?: number } { try { const envPath = envPathForProfile(profile) if (!existsSync(envPath)) return {} @@ -761,6 +764,7 @@ function getSSHEnvVars(profile?: string): { host?: string; user?: string; key?: host: vars.TERMINAL_SSH_HOST, user: vars.TERMINAL_SSH_USER, key: vars.TERMINAL_SSH_KEY, + port: vars.TERMINAL_SSH_PORT ? parseInt(vars.TERMINAL_SSH_PORT, 10) : undefined, } } catch { return {} @@ -827,7 +831,7 @@ export async function createFileProvider(profile?: string): Promise