mirror of https://github.com/perkeep/perkeep.git
importer: support for disabling importers at start-up
Change-Id: Ia2fc81f496ed020669a1c6ede489197d4a52ae89
This commit is contained in:
parent
4155ac6a3c
commit
9bea14733d
|
@ -64,6 +64,10 @@ CAMLI_DEV_CLOSURE_DIR (string):
|
||||||
Path override for pkg/server. If specified, this path will be used to serve
|
Path override for pkg/server. If specified, this path will be used to serve
|
||||||
the closure handler.
|
the closure handler.
|
||||||
|
|
||||||
|
CAMLI_DISABLE_IMPORTERS (bool):
|
||||||
|
If true, importers are disabled (at least automatic background
|
||||||
|
importing, e.g. at start-up). Mostly for debugging.
|
||||||
|
|
||||||
CAMLI_HTTP_DEBUG (bool):
|
CAMLI_HTTP_DEBUG (bool):
|
||||||
Enable per-request logging in pkg/webserver.
|
Enable per-request logging in pkg/webserver.
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,9 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"os"
|
||||||
"sort"
|
"sort"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
@ -612,7 +614,13 @@ func (h *Host) startPeriodicImporters() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var disableImporters, _ = strconv.ParseBool(os.Getenv("CAMLI_DISABLE_IMPORTERS"))
|
||||||
|
|
||||||
func (ia *importerAcct) maybeStart() {
|
func (ia *importerAcct) maybeStart() {
|
||||||
|
if disableImporters {
|
||||||
|
log.Printf("Importers disabled, per environment.")
|
||||||
|
return
|
||||||
|
}
|
||||||
acctObj, err := ia.im.host.ObjectFromRef(ia.acct.PermanodeRef())
|
acctObj, err := ia.im.host.ObjectFromRef(ia.acct.PermanodeRef())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Error maybe starting %v: %v", ia.acct.PermanodeRef(), err)
|
log.Printf("Error maybe starting %v: %v", ia.acct.PermanodeRef(), err)
|
||||||
|
|
Loading…
Reference in New Issue