feat: support prefix.
This commit is contained in:
parent
3283611d7f
commit
ddf94bb963
22
cmd/kv.go
22
cmd/kv.go
@ -20,6 +20,7 @@ func init() {
|
||||
|
||||
kvCmd.PersistentFlags().StringSlice("endpoints", []string{"localhost:8500"}, "Comma separated list of endpoints.")
|
||||
kvCmd.PersistentFlags().Int("connection-timeout", 0, "Connection timeout in seconds.")
|
||||
kvCmd.PersistentFlags().String("prefix", "traefik", "Prefix used for KV store.")
|
||||
kvCmd.PersistentFlags().String("password", "", "Password for connection.")
|
||||
kvCmd.PersistentFlags().String("username", "", "Username for connection.")
|
||||
|
||||
@ -40,28 +41,13 @@ func getKvConfig(cmd *cobra.Command) (*kv.Config, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
password, err := cmd.Flags().GetString("password")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
username, err := cmd.Flags().GetString("username")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &kv.Config{
|
||||
Endpoints: endpoints,
|
||||
Prefix: cmd.Flag("prefix").Value.String(),
|
||||
Options: &store.Config{
|
||||
ClientTLS: nil,
|
||||
TLS: nil,
|
||||
ConnectionTimeout: time.Duration(connectionTimeout) * time.Second,
|
||||
SyncPeriod: 0,
|
||||
Bucket: "",
|
||||
PersistConnection: false,
|
||||
Username: username,
|
||||
Password: password,
|
||||
Token: "",
|
||||
Username: cmd.Flag("password").Value.String(),
|
||||
Password: cmd.Flag("username").Value.String(),
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ import "github.com/abronan/valkeyrie/store"
|
||||
// Config FIXME
|
||||
type Config struct {
|
||||
Backend store.Backend
|
||||
Prefix string
|
||||
Endpoints []string
|
||||
Options *store.Config
|
||||
}
|
||||
|
||||
@ -11,8 +11,7 @@ import (
|
||||
"github.com/ldez/traefik-certs-dumper/dumper"
|
||||
)
|
||||
|
||||
// FIXME prefix
|
||||
const storeKey = "traefik/acme/account/object"
|
||||
const storeKey = "/acme/account/object"
|
||||
|
||||
// Dump FIXME
|
||||
func Dump(config *Config, baseConfig *dumper.BaseConfig) error {
|
||||
@ -21,7 +20,7 @@ func Dump(config *Config, baseConfig *dumper.BaseConfig) error {
|
||||
return err
|
||||
}
|
||||
|
||||
pair, err := kvStore.Get(storeKey, nil)
|
||||
pair, err := kvStore.Get(config.Prefix+storeKey, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user