2023-03-28 19:12:30 +00:00
|
|
|
// Copyright (c) HashiCorp, Inc.
|
2023-08-11 13:12:13 +00:00
|
|
|
// SPDX-License-Identifier: BUSL-1.1
|
2023-03-28 19:12:30 +00:00
|
|
|
|
2017-10-11 12:51:25 +00:00
|
|
|
package kv
|
2016-09-26 15:10:58 +00:00
|
|
|
|
|
|
|
import (
|
2017-10-11 12:51:25 +00:00
|
|
|
"github.com/hashicorp/consul/command/flags"
|
2016-09-26 15:10:58 +00:00
|
|
|
"github.com/mitchellh/cli"
|
|
|
|
)
|
|
|
|
|
2017-10-11 12:51:25 +00:00
|
|
|
func New() *cmd {
|
|
|
|
return &cmd{}
|
2016-09-26 15:10:58 +00:00
|
|
|
}
|
|
|
|
|
2017-10-11 12:51:25 +00:00
|
|
|
type cmd struct{}
|
|
|
|
|
|
|
|
func (c *cmd) Run(args []string) int {
|
2016-09-26 15:10:58 +00:00
|
|
|
return cli.RunResultHelp
|
|
|
|
}
|
|
|
|
|
2017-10-11 12:51:25 +00:00
|
|
|
func (c *cmd) Synopsis() string {
|
2017-10-17 13:44:20 +00:00
|
|
|
return synopsis
|
2017-10-11 12:51:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (c *cmd) Help() string {
|
2017-10-17 22:00:01 +00:00
|
|
|
return flags.Usage(help, nil)
|
2017-10-17 13:44:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const synopsis = "Interact with the key-value store"
|
|
|
|
const help = `
|
|
|
|
Usage: consul kv <subcommand> [options] [args]
|
2016-09-26 15:10:58 +00:00
|
|
|
|
|
|
|
This command has subcommands for interacting with Consul's key-value
|
|
|
|
store. Here are some simple examples, and more detailed examples are
|
|
|
|
available in the subcommands or the documentation.
|
|
|
|
|
|
|
|
Create or update the key named "redis/config/connections" with the value "5":
|
|
|
|
|
|
|
|
$ consul kv put redis/config/connections 5
|
|
|
|
|
|
|
|
Read this value back:
|
|
|
|
|
|
|
|
$ consul kv get redis/config/connections
|
|
|
|
|
|
|
|
Or get detailed key information:
|
|
|
|
|
|
|
|
$ consul kv get -detailed redis/config/connections
|
|
|
|
|
|
|
|
Finally, delete the key:
|
|
|
|
|
|
|
|
$ consul kv delete redis/config/connections
|
|
|
|
|
2017-10-17 13:44:20 +00:00
|
|
|
For more examples, ask for subcommand help or view the documentation.
|
|
|
|
`
|