mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-10-29 17:52:32 +00:00
Add option for not mounting the KV mount in --dev (#16974)
* Add option for not mounting the KV mount in --dev * Fix whitespace I messed up during merge conflict resolution * Feature -> Improvement * Fix formatting for real --------- Co-authored-by: Violet Hynes <violet.hynes@hashicorp.com>
This commit is contained in:
3
changelog/16974.txt
Normal file
3
changelog/16974.txt
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
```release-note:improvement
|
||||||
|
cli: Add a `--dev-no-kv` flag to prevent auto mounting a key-value secret backend when running a dev server
|
||||||
|
```
|
||||||
@@ -135,6 +135,7 @@ type ServerCommand struct {
|
|||||||
flagDevLatency int
|
flagDevLatency int
|
||||||
flagDevLatencyJitter int
|
flagDevLatencyJitter int
|
||||||
flagDevLeasedKV bool
|
flagDevLeasedKV bool
|
||||||
|
flagDevNoKV bool
|
||||||
flagDevKVV1 bool
|
flagDevKVV1 bool
|
||||||
flagDevSkipInit bool
|
flagDevSkipInit bool
|
||||||
flagDevThreeNode bool
|
flagDevThreeNode bool
|
||||||
@@ -345,6 +346,13 @@ func (c *ServerCommand) Flags() *FlagSets {
|
|||||||
Hidden: true,
|
Hidden: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
f.BoolVar(&BoolVar{
|
||||||
|
Name: "dev-no-kv",
|
||||||
|
Target: &c.flagDevNoKV,
|
||||||
|
Default: false,
|
||||||
|
Hidden: true,
|
||||||
|
})
|
||||||
|
|
||||||
f.BoolVar(&BoolVar{
|
f.BoolVar(&BoolVar{
|
||||||
Name: "dev-kv-v1",
|
Name: "dev-kv-v1",
|
||||||
Target: &c.flagDevKVV1,
|
Target: &c.flagDevKVV1,
|
||||||
@@ -1031,7 +1039,7 @@ func (c *ServerCommand) Run(args []string) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Automatically enable dev mode if other dev flags are provided.
|
// Automatically enable dev mode if other dev flags are provided.
|
||||||
if c.flagDevConsul || c.flagDevHA || c.flagDevTransactional || c.flagDevLeasedKV || c.flagDevThreeNode || c.flagDevFourCluster || c.flagDevAutoSeal || c.flagDevKVV1 || c.flagDevTLS {
|
if c.flagDevConsul || c.flagDevHA || c.flagDevTransactional || c.flagDevLeasedKV || c.flagDevThreeNode || c.flagDevFourCluster || c.flagDevAutoSeal || c.flagDevKVV1 || c.flagDevNoKV || c.flagDevTLS {
|
||||||
c.flagDev = true
|
c.flagDev = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2105,6 +2113,7 @@ func (c *ServerCommand) enableDev(core *vault.Core, coreConfig *vault.CoreConfig
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !c.flagDevNoKV {
|
||||||
kvVer := "2"
|
kvVer := "2"
|
||||||
if c.flagDevKVV1 || c.flagDevLeasedKV {
|
if c.flagDevKVV1 || c.flagDevLeasedKV {
|
||||||
kvVer = "1"
|
kvVer = "1"
|
||||||
@@ -2129,6 +2138,7 @@ func (c *ServerCommand) enableDev(core *vault.Core, coreConfig *vault.CoreConfig
|
|||||||
if resp.IsError() {
|
if resp.IsError() {
|
||||||
return nil, fmt.Errorf("failed to create default KV store: %w", resp.Error())
|
return nil, fmt.Errorf("failed to create default KV store: %w", resp.Error())
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return init, nil
|
return init, nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user