add repo options

This commit is contained in:
idk
2019-12-07 15:25:52 -05:00
parent 309e5c8378
commit 82e50214cd
3 changed files with 23 additions and 1 deletions

View File

@ -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
}
}

View File

@ -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
}

View File

@ -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)