From 467384d8d44dda48e2ec356f6aadf7287c5f9061 Mon Sep 17 00:00:00 2001 From: Chris Capurso <1036769+ccapurso@users.noreply.github.com> Date: Thu, 10 Nov 2022 16:46:59 -0500 Subject: [PATCH] add noop ent supported storage check (#17883) --- command/server.go | 19 +++++++++---------- command/server_util.go | 6 +++--- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/command/server.go b/command/server.go index ee5b13340e..d4e960f167 100644 --- a/command/server.go +++ b/command/server.go @@ -78,9 +78,8 @@ const ( // Even though there are more types than the ones below, the following consts // are declared internally for value comparison and reusability. - storageTypeRaft = "raft" - storageTypeConsul = "consul" - disableStorageTypeCheckEnv = "VAULT_DISABLE_SUPPORTED_STORAGE_CHECK" + storageTypeRaft = "raft" + storageTypeConsul = "consul" ) type ServerCommand struct { @@ -1413,7 +1412,13 @@ func (c *ServerCommand) Run(args []string) int { // Apply any enterprise configuration onto the 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{ "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(wrapAtLength(fmt.Sprintf("WARNING: storage configured to use %q which should NOT be used in production", coreConfig.StorageType))) c.UI.Warn("") - } else { - err = checkStorageTypeForEnt(&coreConfig) - if err != nil { - c.UI.Error(fmt.Sprintf("Invalid storage type: %s", err)) - return 1 - } } } diff --git a/command/server_util.go b/command/server_util.go index 1959f17662..d5d9c8f4f3 100644 --- a/command/server_util.go +++ b/command/server_util.go @@ -7,7 +7,7 @@ import ( var ( adjustCoreConfigForEnt = adjustCoreConfigForEntNoop - checkStorageTypeForEnt = checkStorageTypeForEntNoop + storageSupportedForEnt = checkStorageTypeForEntNoop ) func adjustCoreConfigForEntNoop(config *server.Config, coreConfig *vault.CoreConfig) { @@ -19,6 +19,6 @@ func getFIPSInfoKeyNoop() string { return "" } -func checkStorageTypeForEntNoop(coreConfig *vault.CoreConfig) error { - return nil +func checkStorageTypeForEntNoop(coreConfig *vault.CoreConfig) bool { + return true }