From f638ae9a239d5f6b0c8596d18373135a86868778 Mon Sep 17 00:00:00 2001 From: JanHoefelmeyer Date: Tue, 21 Mar 2023 08:26:51 +0100 Subject: [PATCH] Move disabling of lockfile from explicit option to empty string in lockfile --- cmd/csaf_aggregator/config.go | 9 +++++---- docs/csaf_aggregator.md | 4 +--- docs/examples/aggregator.toml | 1 - 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/cmd/csaf_aggregator/config.go b/cmd/csaf_aggregator/config.go index ca2ddae..4a18f92 100644 --- a/cmd/csaf_aggregator/config.go +++ b/cmd/csaf_aggregator/config.go @@ -75,7 +75,6 @@ type config struct { // LockFile tries to lock to a given file. LockFile *string `toml:"lock_file"` - NoLock bool `toml:"no_lock"` // Interim performs an interim scan. Interim bool `toml:"interim"` @@ -267,12 +266,14 @@ func (c *config) setDefaults() { c.Domain = defaultDomain } - if c.NoLock { - c.LockFile = nil - } else if c.LockFile == nil { + if c.LockFile == nil { c.LockFile = &defaultLockFile } + if c.LockFile == "" { + c.LockFile = nil + } + if c.Workers <= 0 { if n := runtime.NumCPU(); n > defaultWorkers { c.Workers = defaultWorkers diff --git a/docs/csaf_aggregator.md b/docs/csaf_aggregator.md index e81acfe..69eb9c5 100644 --- a/docs/csaf_aggregator.md +++ b/docs/csaf_aggregator.md @@ -91,8 +91,7 @@ openpgp_private_key // OpenPGP private key (must have no passphrase set, if // you want to be able to run unattended, e.g. via cron.) openpgp_public_key // OpenPGP public key passphrase // passphrase of the OpenPGP key -lock_file // path to lockfile, to stop other instances if one is not done (default:/var/csaf_aggregator/run.lock) -no_lock // explicitely disable usage of lock files. (default: false) +lock_file // path to lockfile, to stop other instances if one is not done (default:/var/csaf_aggregator/run.lock, disable by setting it to "") interim_years // limiting the years for which interim documents are searched (default 0) verbose // print more diagnostic output, e.g. https requests (default false) allow_single_provider // debugging option (default false) @@ -159,7 +158,6 @@ categories document. For a more detailed explanation and examples, workers = 2 folder = "/var/csaf_aggregator" lock_file = "/var/csaf_aggregator/run.lock" -#no_lock = false web = "/var/csaf_aggregator/html" domain = "https://localhost:9443" rate = 10.0 diff --git a/docs/examples/aggregator.toml b/docs/examples/aggregator.toml index 235a891..ac73cc4 100644 --- a/docs/examples/aggregator.toml +++ b/docs/examples/aggregator.toml @@ -1,7 +1,6 @@ workers = 2 folder = "/var/csaf_aggregator" lock_file = "/var/csaf_aggregator/run.lock" -#no_lock = false web = "/var/csaf_aggregator/html" domain = "https://localhost:9443" rate = 10.0