2
Hockeypuck - OpenPGP key server
3
Copyright (C) 2012-2014 Casey Marshall
5
This program is free software: you can redistribute it and/or modify
6
it under the terms of the GNU Affero General Public License as published by
7
the Free Software Foundation, version 3.
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU Affero General Public License for more details.
14
You should have received a copy of the GNU Affero General Public License
15
along with this program. If not, see <http://www.gnu.org/licenses/>.
18
// hockeypuck is an OpenPGP keyserver.
24
. "github.com/hockeypuck/hockeypuck"
25
"github.com/hockeypuck/hockeypuck/openpgp"
26
"launchpad.net/gnuflag"
28
"github.com/syndtr/goleveldb/leveldb"
29
"github.com/syndtr/goleveldb/leveldb/storage"
32
type recoverCmd struct {
36
func (rc *recoverCmd) Name() string { return "recover" }
38
func (rc *recoverCmd) Desc() string { return "Recover prefix tree" }
40
func newRecoverCmd() *recoverCmd {
41
cmd := new(recoverCmd)
42
flags := gnuflag.NewFlagSet(cmd.Name(), gnuflag.ExitOnError)
43
flags.StringVar(&cmd.configPath, "config", "", "Hockeypuck configuration file")
48
func (ec *recoverCmd) Main() {
49
ec.configuredCmd.Main()
51
path := openpgp.Config().Settings.TomlTree.Get("conflux.recon.leveldb.path").(string)
52
stor, err := storage.OpenFile(path)
56
log.Println("database storage opened, recovering...")
57
db, err := leveldb.Recover(stor, nil)
61
log.Println("recovery complete")