Skip to content

Commit

Permalink
Merge pull request #141 from cole-h/sshopts
Browse files Browse the repository at this point in the history
nix: add config file to NIX_SSHOPTS
  • Loading branch information
srhb authored Apr 29, 2021
2 parents c048d63 + cdd9f7d commit 8d5b037
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion nix/nix.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ func Push(ctx *ssh.SSHContext, host Host, paths ...string) (err error) {

var userArg = ""
var keyArg = ""
var sshOpts = []string{}
var env = os.Environ()
if host.TargetUser != "" {
userArg = host.TargetUser + "@"
Expand All @@ -360,7 +361,13 @@ func Push(ctx *ssh.SSHContext, host Host, paths ...string) (err error) {
keyArg = "?ssh-key=" + ctx.IdentityFile
}
if ctx.SkipHostKeyCheck {
env = append(env, fmt.Sprintf("NIX_SSHOPTS=%s", "-o StrictHostkeyChecking=No -o UserKnownHostsFile=/dev/null"))
sshOpts = append(sshOpts, fmt.Sprintf("%s", "-o StrictHostkeyChecking=No -o UserKnownHostsFile=/dev/null"))
}
if ctx.ConfigFile != "" {
sshOpts = append(sshOpts, fmt.Sprintf("-F %s", ctx.ConfigFile))
}
if len(sshOpts) > 0 {
env = append(env, fmt.Sprintf("NIX_SSHOPTS=%s", strings.Join(sshOpts, " ")))
}

options := mkOptions(host)
Expand Down

0 comments on commit 8d5b037

Please # to comment.