From f1a5bc2c14a274372d50e7c204a16a93448794e5 Mon Sep 17 00:00:00 2001 From: Jean-Louis Huynen Date: Wed, 3 Mar 2021 12:10:46 +0100 Subject: [PATCH] chg: [filewatcher] daily rotation of watched folder - fixed --- d4-goclient.go | 26 +++++++++++++------------- go.mod | 3 ++- go.sum | 2 ++ 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/d4-goclient.go b/d4-goclient.go index f6e6a9f..dde34c3 100644 --- a/d4-goclient.go +++ b/d4-goclient.go @@ -70,7 +70,7 @@ type ( rate time.Duration cc bool tor bool - daily bool + daily bool json bool ca x509.CertPool d4error uint8 @@ -113,17 +113,17 @@ var ( tmpretry, _ = time.ParseDuration("30s") tmprate, _ = time.ParseDuration("200ms") - confdir = flag.String("c", "", "configuration directory") - debug = flag.Bool("v", false, "Set to True, true, TRUE, 1, or t to enable verbose output on stdout - Don't use in production") - ce = flag.Bool("ce", true, "Set to True, true, TRUE, 1, or t to enable TLS on network destination") - ct = flag.Duration("ct", tmpct, "Set timeout in human format") - cka = flag.Duration("cka", tmpcka, "Keep Alive time human format, 0 to disable") - retry = flag.Duration("rt", tmpretry, "Time in human format before retry after connection failure, set to 0 to exit on failure") - rate = flag.Duration("rl", tmprate, "Rate limiter: time in human format before retry after EOF") - cc = flag.Bool("cc", false, "Check TLS certificate against rootCA.crt") - torflag = flag.Bool("tor", false, "Use a SOCKS5 tor proxy on 9050") - dailyflag = flag.Bool("daily", false, "Sets up filewatcher to watch a new %Y%M%D folder at midnight") - jsonflag = flag.Bool("json", false, "The files watched are json files") + confdir = flag.String("c", "", "configuration directory") + debug = flag.Bool("v", false, "Set to True, true, TRUE, 1, or t to enable verbose output on stdout - Don't use in production") + ce = flag.Bool("ce", true, "Set to True, true, TRUE, 1, or t to enable TLS on network destination") + ct = flag.Duration("ct", tmpct, "Set timeout in human format") + cka = flag.Duration("cka", tmpcka, "Keep Alive time human format, 0 to disable") + retry = flag.Duration("rt", tmpretry, "Time in human format before retry after connection failure, set to 0 to exit on failure") + rate = flag.Duration("rl", tmprate, "Rate limiter: time in human format before retry after EOF") + cc = flag.Bool("cc", false, "Check TLS certificate against rootCA.crt") + torflag = flag.Bool("tor", false, "Use a SOCKS5 tor proxy on 9050") + dailyflag = flag.Bool("daily", false, "Sets up filewatcher to watch a new %Y%M%D folder at midnight") + jsonflag = flag.Bool("json", false, "The files watched are json files") ) func main() { @@ -522,7 +522,7 @@ func setReaderWriters(d4 *d4S, force bool) bool { } case "folder": var err error - (*d4).src, err = inputreader.NewFileWatcherReader((*d4).conf.folderstr, (*d4).json, (*d4).daily) + (*d4).src, err = inputreader.NewFileWatcherReader((*d4).conf.folderstr, (*d4).json, (*d4).daily, logger) if err != nil { log.Printf("Could not create File Watcher %q \n", err) return false diff --git a/go.mod b/go.mod index 8134dd9..ecad081 100644 --- a/go.mod +++ b/go.mod @@ -2,8 +2,9 @@ module github.com/D4-project/d4-goclient go 1.13 + require ( - github.com/D4-project/d4-golang-utils v0.1.13 + github.com/D4-project/d4-golang-utils v0.1.14 github.com/gofrs/uuid v4.0.0+incompatible // indirect github.com/gomodule/redigo v2.0.0+incompatible golang.org/x/net v0.0.0-20210119194325-5f4716e94777 diff --git a/go.sum b/go.sum index 3a5d270..f2c7524 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,7 @@ github.com/D4-project/d4-golang-utils v0.1.13 h1:pqa72t2HrbL3QZUGnK0o8wtWOuslkkz8F5E0BzKjwio= github.com/D4-project/d4-golang-utils v0.1.13/go.mod h1:qXVZ3kCL72i3uYe29t7aEy9dU0bNqtFvcoNE1dJu0zo= +github.com/D4-project/d4-golang-utils v0.1.14 h1:APwN+i4qyDrxT8gvlbeV/VXfNas2GvPWOnkTGX1K2Lo= +github.com/D4-project/d4-golang-utils v0.1.14/go.mod h1:qXVZ3kCL72i3uYe29t7aEy9dU0bNqtFvcoNE1dJu0zo= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw=