importer: support for disabling importers at start-up

Change-Id: Ia2fc81f496ed020669a1c6ede489197d4a52ae89
This commit is contained in:
Brad Fitzpatrick 2015-01-18 19:02:02 -08:00
parent 4155ac6a3c
commit 9bea14733d
2 changed files with 12 additions and 0 deletions

View File

@ -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.

View File

@ -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)