mirror of https://github.com/perkeep/perkeep.git
Make the devcam server search handler honor the secring and identity flags.
Change-Id: I7bfbbc82f9ed429b2fa61c84e8c0d514641444fe
This commit is contained in:
parent
0001fc10ae
commit
63ec18c3f3
|
@ -263,7 +263,7 @@
|
||||||
"handler": "search",
|
"handler": "search",
|
||||||
"handlerArgs": {
|
"handlerArgs": {
|
||||||
"index": ["_env", "${CAMLI_INDEXER_PATH}"],
|
"index": ["_env", "${CAMLI_INDEXER_PATH}"],
|
||||||
"owner": "sha1-f2b0b7da718b97ce8c31591d8ed4645c777f3ef4",
|
"owner": ["_env", "${CAMLI_PUBKEY_BLOBREF}"],
|
||||||
"slurpToMemory": true,
|
"slurpToMemory": true,
|
||||||
"devBlockStartupOn": "/sync-index/"
|
"devBlockStartupOn": "/sync-index/"
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,9 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"camlistore.org/pkg/blob"
|
||||||
|
"camlistore.org/pkg/jsonsign"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -87,20 +90,34 @@ func (e *Env) SetCamdevVars(altkey bool) {
|
||||||
e.Set("CAMLI_CONFIG_DIR", filepath.Join("config", "dev-client-dir"))
|
e.Set("CAMLI_CONFIG_DIR", filepath.Join("config", "dev-client-dir"))
|
||||||
e.Set("CAMLI_AUTH", "userpass:camlistore:pass3179")
|
e.Set("CAMLI_AUTH", "userpass:camlistore:pass3179")
|
||||||
e.Set("CAMLI_DEV_KEYBLOBS", filepath.FromSlash("config/dev-client-dir/keyblobs"))
|
e.Set("CAMLI_DEV_KEYBLOBS", filepath.FromSlash("config/dev-client-dir/keyblobs"))
|
||||||
|
|
||||||
|
secring := defaultSecring
|
||||||
|
identity := defaultIdentity
|
||||||
|
|
||||||
if altkey {
|
if altkey {
|
||||||
e.Set("CAMLI_SECRET_RING", filepath.FromSlash("pkg/jsonsign/testdata/password-foo-secring.gpg"))
|
secring = filepath.FromSlash("pkg/jsonsign/testdata/password-foo-secring.gpg")
|
||||||
e.Set("CAMLI_KEYID", "C7C3E176")
|
identity = "C7C3E176"
|
||||||
println("**\n** Note: password is \"foo\"\n**\n")
|
println("**\n** Note: password is \"foo\"\n**\n")
|
||||||
} else {
|
} else {
|
||||||
if *flagSecretRing != "" {
|
if *flagSecretRing != "" {
|
||||||
e.Set("CAMLI_SECRET_RING", *flagSecretRing)
|
secring = *flagSecretRing
|
||||||
} else {
|
|
||||||
e.Set("CAMLI_SECRET_RING", filepath.FromSlash(defaultSecring))
|
|
||||||
}
|
}
|
||||||
if *flagIdentity != "" {
|
if *flagIdentity != "" {
|
||||||
e.Set("CAMLI_KEYID", *flagIdentity)
|
identity = *flagIdentity
|
||||||
} else {
|
|
||||||
e.Set("CAMLI_KEYID", defaultIdentity)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
entity, err := jsonsign.EntityFromSecring(identity, secring)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
armoredPublicKey, err := jsonsign.ArmoredPublicKey(entity)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
pubKeyRef := blob.SHA1FromString(armoredPublicKey)
|
||||||
|
|
||||||
|
e.Set("CAMLI_SECRET_RING", secring)
|
||||||
|
e.Set("CAMLI_KEYID", identity)
|
||||||
|
e.Set("CAMLI_PUBKEY_BLOBREF", pubKeyRef.String())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue