Skip to content

Commit

Permalink
feat: add IncludeFile for rsync provider
Browse files Browse the repository at this point in the history
  • Loading branch information
idawnlight committed Sep 20, 2023
1 parent db285a6 commit a251267
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
1 change: 1 addition & 0 deletions worker/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ type mirrorConfig struct {
UseIPv6 bool `toml:"use_ipv6"`
UseIPv4 bool `toml:"use_ipv4"`
ExcludeFile string `toml:"exclude_file"`
IncludeFile string `toml:"include_file"`
Username string `toml:"username"`
Password string `toml:"password"`
RsyncNoTimeo bool `toml:"rsync_no_timeout"`
Expand Down
30 changes: 17 additions & 13 deletions worker/rsync_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,20 @@ import (
)

type rsyncConfig struct {
name string
rsyncCmd string
upstreamURL, username, password, excludeFile string
extraOptions []string
overriddenOptions []string
rsyncNeverTimeout bool
rsyncTimeoutValue int
rsyncEnv map[string]string
workingDir, logDir, logFile string
useIPv6, useIPv4 bool
interval time.Duration
retry int
timeout time.Duration
name string
rsyncCmd string
upstreamURL, username, password string
excludeFile, includeFile string
extraOptions []string
overriddenOptions []string
rsyncNeverTimeout bool
rsyncTimeoutValue int
rsyncEnv map[string]string
workingDir, logDir, logFile string
useIPv6, useIPv4 bool
interval time.Duration
retry int
timeout time.Duration

uid int
gid int
Expand Down Expand Up @@ -95,6 +96,9 @@ func newRsyncProvider(c rsyncConfig) (*rsyncProvider, error) {
if c.excludeFile != "" {
options = append(options, "--exclude-from", c.excludeFile)
}
if c.includeFile != "" {
options = append(options, "--include-from", c.includeFile)
}
if c.extraOptions != nil {
options = append(options, c.extraOptions...)
}
Expand Down

0 comments on commit a251267

Please sign in to comment.