diff --git a/doc/environment-vars.txt b/doc/environment-vars.txt index 8f615f4f6..fab3c3158 100644 --- a/doc/environment-vars.txt +++ b/doc/environment-vars.txt @@ -64,6 +64,10 @@ CAMLI_DEV_CLOSURE_DIR (string): Path override for pkg/server. If specified, this path will be used to serve 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): Enable per-request logging in pkg/webserver. diff --git a/pkg/importer/importer.go b/pkg/importer/importer.go index c983073ae..90bd79ee8 100644 --- a/pkg/importer/importer.go +++ b/pkg/importer/importer.go @@ -24,7 +24,9 @@ import ( "log" "net/http" "net/url" + "os" "sort" + "strconv" "strings" "sync" "time" @@ -612,7 +614,13 @@ func (h *Host) startPeriodicImporters() { } } +var disableImporters, _ = strconv.ParseBool(os.Getenv("CAMLI_DISABLE_IMPORTERS")) + func (ia *importerAcct) maybeStart() { + if disableImporters { + log.Printf("Importers disabled, per environment.") + return + } acctObj, err := ia.im.host.ObjectFromRef(ia.acct.PermanodeRef()) if err != nil { log.Printf("Error maybe starting %v: %v", ia.acct.PermanodeRef(), err)