mirror of
https://github.com/alexgo-io/opi-on-bitcoin-oracle.git
synced 2026-04-30 20:01:43 +08:00
Revert "🔨 chore: refactor rsync command to securely handle private key passph… (#9)"
This reverts commit b08861e768.
This commit is contained in:
@@ -164,16 +164,8 @@ export function create(params: { name: string; region: string; size: string }) {
|
||||
throw new Error(`not found: ${loc}`)
|
||||
}
|
||||
const hash = generateDirectoryHash(loc).slice(0, 5)
|
||||
const privateKeyPassword = process.env['PRIVATE_KEY_PASSWORD']
|
||||
|
||||
// Use an expect script to interact with ssh-add securely, if privateKeyPassword is set.
|
||||
let addKeyCommand = privateKeyPassword != null && privateKeyPassword?.length > 0
|
||||
? `expect -c 'spawn ssh-add ${privateKey}; expect "Enter passphrase for"; send "${privateKeyPassword}\\r"; interact'`
|
||||
: `ssh-add ${privateKey}`
|
||||
|
||||
const rsyncCommand = `eval $(ssh-agent -s) && ${addKeyCommand} && RSYNC_RSH="ssh -i ${privateKey}" rsync -avP ${loc} ${connection.user}@${droplet.ipv4Address}:${remotePath} && kill $SSH_AGENT_PID`
|
||||
return new local.Command(`${name}:copyFiles ${unroot(loc)}`, {
|
||||
create: pulumi.interpolate`${rsyncCommand}`,
|
||||
create: pulumi.interpolate`rsync -avP ${loc} ${connection.user}@${droplet.ipv4Address}:${remotePath}`,
|
||||
triggers: [hash, loc, remotePath],
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user