in case rsyncEnv is nil

This commit is contained in:
z4yx 2020-03-16 21:11:15 +08:00
parent 365f49e6d3
commit ae5ff25d20
2 changed files with 6 additions and 0 deletions

View File

@ -51,6 +51,9 @@ func newRsyncProvider(c rsyncConfig) (*rsyncProvider, error) {
if c.rsyncCmd == "" { if c.rsyncCmd == "" {
provider.rsyncCmd = "rsync" provider.rsyncCmd = "rsync"
} }
if c.rsyncEnv == nil {
c.rsyncEnv = map[string]string{}
}
if c.username != "" { if c.username != "" {
c.rsyncEnv["USER"] = c.username c.rsyncEnv["USER"] = c.username
} }

View File

@ -70,6 +70,9 @@ func newTwoStageRsyncProvider(c twoStageRsyncConfig) (*twoStageRsyncProvider, er
}, },
} }
if c.rsyncEnv == nil {
c.rsyncEnv = map[string]string{}
}
if c.username != "" { if c.username != "" {
c.rsyncEnv["USER"] = c.username c.rsyncEnv["USER"] = c.username
} }