add repo options
This commit is contained in:
@ -497,3 +497,19 @@ func SetGenContents(b bool) func(*RepoSam) error {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
//SetWatch tells the connection to close it's tunnels during extended idle time.
|
||||
func SetWatch(b bool) func(*RepoSam) error {
|
||||
return func(c *RepoSam) error {
|
||||
c.watch = b
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
//SetWatchInterval tells the connection to close it's tunnels during extended idle time.
|
||||
func SetWatchInterval(b int) func(*RepoSam) error {
|
||||
return func(c *RepoSam) error {
|
||||
c.watchInterval = b
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
@ -37,6 +37,8 @@ type RepoSam struct {
|
||||
origin string
|
||||
description string
|
||||
privateKey []byte
|
||||
watch bool
|
||||
watchInterval int
|
||||
|
||||
password string
|
||||
// ServeDir string
|
||||
@ -60,7 +62,9 @@ func (f *RepoSam) ServeParent() {
|
||||
func (f *RepoSam) Serve() error {
|
||||
go f.ServeParent()
|
||||
if f.Up() {
|
||||
|
||||
if err = f.Repo.ServeRepo(f.watch, true, f.privateKey, f.inRoot, f.outRoot, f.watchInterval); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -170,6 +170,8 @@ func main() {
|
||||
reposam.SetOrigin(*origin),
|
||||
reposam.SetDescription(*description),
|
||||
reposam.SetPrivateKey(buf),
|
||||
reposam.SetWatch(*watch),
|
||||
reposam.SetWatchInterval(*watchInterval),
|
||||
)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
Reference in New Issue
Block a user