mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-01 19:17:58 +00:00
add noop ent supported storage check (#17883)
This commit is contained in:
@@ -78,9 +78,8 @@ const (
|
|||||||
|
|
||||||
// Even though there are more types than the ones below, the following consts
|
// Even though there are more types than the ones below, the following consts
|
||||||
// are declared internally for value comparison and reusability.
|
// are declared internally for value comparison and reusability.
|
||||||
storageTypeRaft = "raft"
|
storageTypeRaft = "raft"
|
||||||
storageTypeConsul = "consul"
|
storageTypeConsul = "consul"
|
||||||
disableStorageTypeCheckEnv = "VAULT_DISABLE_SUPPORTED_STORAGE_CHECK"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type ServerCommand struct {
|
type ServerCommand struct {
|
||||||
@@ -1413,7 +1412,13 @@ func (c *ServerCommand) Run(args []string) int {
|
|||||||
// Apply any enterprise configuration onto the coreConfig.
|
// Apply any enterprise configuration onto the coreConfig.
|
||||||
adjustCoreConfigForEnt(config, &coreConfig)
|
adjustCoreConfigForEnt(config, &coreConfig)
|
||||||
|
|
||||||
if !c.flagDev && os.Getenv(disableStorageTypeCheckEnv) == "" {
|
if !storageSupportedForEnt(&coreConfig) {
|
||||||
|
c.UI.Warn("")
|
||||||
|
c.UI.Warn(wrapAtLength(fmt.Sprintf("WARNING: storage configured to use %q which is not supported for Vault Enterprise, must be \"raft\" or \"consul\"", coreConfig.StorageType)))
|
||||||
|
c.UI.Warn("")
|
||||||
|
}
|
||||||
|
|
||||||
|
if !c.flagDev {
|
||||||
inMemStorageTypes := []string{
|
inMemStorageTypes := []string{
|
||||||
"inmem", "inmem_ha", "inmem_transactional", "inmem_transactional_ha",
|
"inmem", "inmem_ha", "inmem_transactional", "inmem_transactional_ha",
|
||||||
}
|
}
|
||||||
@@ -1422,12 +1427,6 @@ func (c *ServerCommand) Run(args []string) int {
|
|||||||
c.UI.Warn("")
|
c.UI.Warn("")
|
||||||
c.UI.Warn(wrapAtLength(fmt.Sprintf("WARNING: storage configured to use %q which should NOT be used in production", coreConfig.StorageType)))
|
c.UI.Warn(wrapAtLength(fmt.Sprintf("WARNING: storage configured to use %q which should NOT be used in production", coreConfig.StorageType)))
|
||||||
c.UI.Warn("")
|
c.UI.Warn("")
|
||||||
} else {
|
|
||||||
err = checkStorageTypeForEnt(&coreConfig)
|
|
||||||
if err != nil {
|
|
||||||
c.UI.Error(fmt.Sprintf("Invalid storage type: %s", err))
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
adjustCoreConfigForEnt = adjustCoreConfigForEntNoop
|
adjustCoreConfigForEnt = adjustCoreConfigForEntNoop
|
||||||
checkStorageTypeForEnt = checkStorageTypeForEntNoop
|
storageSupportedForEnt = checkStorageTypeForEntNoop
|
||||||
)
|
)
|
||||||
|
|
||||||
func adjustCoreConfigForEntNoop(config *server.Config, coreConfig *vault.CoreConfig) {
|
func adjustCoreConfigForEntNoop(config *server.Config, coreConfig *vault.CoreConfig) {
|
||||||
@@ -19,6 +19,6 @@ func getFIPSInfoKeyNoop() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkStorageTypeForEntNoop(coreConfig *vault.CoreConfig) error {
|
func checkStorageTypeForEntNoop(coreConfig *vault.CoreConfig) bool {
|
||||||
return nil
|
return true
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user