🐛 Use interval from config instead of hardcoded value
This commit is contained in:
parent
d01f3c8cdf
commit
5280ae3533
2 changed files with 3 additions and 2 deletions
|
@ -4,7 +4,7 @@ File format used is https://toml.io/en/[toml]. You can specify config file in fi
|
||||||
|
|
||||||
== Options:
|
== Options:
|
||||||
* `clonedirectory`: Directory where mirror is clone
|
* `clonedirectory`: Directory where mirror is clone
|
||||||
* `interval`: Update interval
|
* `interval`: Update interval in minute
|
||||||
* `log`: Log config section
|
* `log`: Log config section
|
||||||
** `level`: Log level, allowed value is: "DEBUG", "INFO", "WARN", "ERROR", "FATAL"
|
** `level`: Log level, allowed value is: "DEBUG", "INFO", "WARN", "ERROR", "FATAL"
|
||||||
** `file`: Log file, default (empty) is in stderr
|
** `file`: Log file, default (empty) is in stderr
|
||||||
|
|
3
main.go
3
main.go
|
@ -40,7 +40,8 @@ func main() {
|
||||||
|
|
||||||
git.StartClone(initConfig.RepoList)
|
git.StartClone(initConfig.RepoList)
|
||||||
|
|
||||||
cron.Launch(time.Minute, initConfig.RepoList)
|
duration := time.Duration(initConfig.Interval) * time.Minute
|
||||||
|
cron.Launch(duration, initConfig.RepoList)
|
||||||
|
|
||||||
quitSignal := make(chan os.Signal, 1)
|
quitSignal := make(chan os.Signal, 1)
|
||||||
signal.Notify(quitSignal, syscall.SIGINT, syscall.SIGTERM)
|
signal.Notify(quitSignal, syscall.SIGINT, syscall.SIGTERM)
|
||||||
|
|
Loading…
Reference in a new issue