mirror of https://github.com/perkeep/perkeep.git
Merge branch 'master' of https://camlistore.googlesource.com/camlistore
This commit is contained in:
commit
b98ea43e45
|
@ -6,7 +6,7 @@
|
|||
# http://code.google.com/legal/individual-cla-v1.0.html (electronic submission)
|
||||
# http://code.google.com/legal/corporate-cla-v1.0.html (requires FAX)
|
||||
#
|
||||
# Note that the CLA isn't a copyright _assigment_ but rather a
|
||||
# Note that the CLA isn't a copyright _assignment_ but rather a
|
||||
# copyright _license_. You retain the copyright on your
|
||||
# contributions.
|
||||
|
||||
|
|
|
@ -62,6 +62,9 @@ CAMLI_DEV_KEYBLOBS (string):
|
|||
CAMLI_HTTP_DEBUG (bool):
|
||||
Enable per-request logging in pkg/webserver.
|
||||
|
||||
CAMLI_HTTP_EXPVAR (bool):
|
||||
Enable json export of expvars at /debug/vars
|
||||
|
||||
CAMLI_HTTP_PPROF (bool):
|
||||
Enable standard library's pprof handler at /debug/pprof/
|
||||
|
||||
|
|
2
make.go
2
make.go
|
@ -467,7 +467,7 @@ func verifyGoVersion() {
|
|||
version := fields[2]
|
||||
switch version {
|
||||
case "go1", "go1.0.1", "go1.0.2", "go1.0.3":
|
||||
log.Fatalf("Your version of Go (%s) is too old. Camlistore requires Go 1.1 or later.")
|
||||
log.Fatalf("Your version of Go (%s) is too old. Camlistore requires Go 1.1 or later.", version)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ package serverconfig
|
|||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"expvar"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
|
@ -409,6 +410,9 @@ func (config *Config) InstallHandlers(hi HandlerInstaller, baseURL string, conte
|
|||
}
|
||||
hl.setupAll()
|
||||
|
||||
if v, _ := strconv.ParseBool(os.Getenv("CAMLI_HTTP_EXPVAR")); v {
|
||||
hi.Handle("/debug/vars", expvarHandler{})
|
||||
}
|
||||
if v, _ := strconv.ParseBool(os.Getenv("CAMLI_HTTP_PPROF")); v {
|
||||
hi.Handle("/debug/pprof/", profileHandler{})
|
||||
}
|
||||
|
@ -426,6 +430,23 @@ func (s multiCloser) Close() (err error) {
|
|||
return
|
||||
}
|
||||
|
||||
// expvarHandler publishes expvar stats.
|
||||
type expvarHandler struct{}
|
||||
|
||||
func (expvarHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||
fmt.Fprintf(w, "{\n")
|
||||
first := true
|
||||
expvar.Do(func(kv expvar.KeyValue) {
|
||||
if !first {
|
||||
fmt.Fprintf(w, ",\n")
|
||||
}
|
||||
first = false
|
||||
fmt.Fprintf(w, "%q: %s", kv.Key, kv.Value)
|
||||
})
|
||||
fmt.Fprintf(w, "\n}\n")
|
||||
}
|
||||
|
||||
// profileHandler publishes server profile information.
|
||||
type profileHandler struct{}
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@
|
|||
camliPath:bar.txt = $blobref_bartxt_permanode
|
||||
</pre>
|
||||
It will appear as a directory containing "dir2" and
|
||||
"bar.txt". (NOTE(hjfreyer): is the value necessarily a permanode?).
|
||||
"bar.txt".
|
||||
<br>
|
||||
These are used by a few things, including the website UI, the
|
||||
"publish" code (declaring you want a photo at a URL and then the
|
||||
|
@ -138,5 +138,3 @@
|
|||
read/write filesystem code.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
NOTE(hjfreyer): did I miss anything?
|
||||
|
|
Loading…
Reference in New Issue