Add the ability to use a dev Consul node for dev storage (#6965)

This commit is contained in:
Jeff Mitchell
2019-06-24 13:29:47 -04:00
committed by GitHub
parent 3f598616c7
commit 2ac94d5581
2 changed files with 24 additions and 12 deletions

View File

@@ -108,6 +108,7 @@ type ServerCommand struct {
flagTestVerifyOnly bool
flagCombineLogs bool
flagTestServerConfig bool
flagDevConsul bool
}
type ServerListener struct {
@@ -292,6 +293,13 @@ func (c *ServerCommand) Flags() *FlagSets {
Hidden: true,
})
f.BoolVar(&BoolVar{
Name: "dev-consul",
Target: &c.flagDevConsul,
Default: false,
Hidden: true,
})
// TODO: should the below flags be public?
f.BoolVar(&BoolVar{
Name: "combine-logs",
@@ -400,7 +408,20 @@ func (c *ServerCommand) Run(args []string) int {
// Load the configuration
var config *server.Config
if c.flagDev {
config = server.DevConfig(c.flagDevHA, c.flagDevTransactional)
var devStorageType string
switch {
case c.flagDevConsul:
devStorageType = "consul"
case c.flagDevHA && c.flagDevTransactional:
devStorageType = "inmem_transactional_ha"
case !c.flagDevHA && c.flagDevTransactional:
devStorageType = "inmem_transactional"
case c.flagDevHA && !c.flagDevTransactional:
devStorageType = "inmem_ha"
default:
devStorageType = "inmem"
}
config = server.DevConfig(devStorageType)
if c.flagDevListenAddr != "" {
config.Listeners[0].Config["address"] = c.flagDevListenAddr
}