fix: allow test/dev environments to skip production encryption key validation

This commit is contained in:
Krypto Kajun
2025-11-08 13:22:28 -06:00
parent f946cea090
commit 90dc7c8723

View File

@@ -255,7 +255,9 @@ func NewKeyManager(config *KeyManagerConfig, logger *logger.Logger) (*KeyManager
// NewKeyManagerWithChainID creates a key manager with specified chain ID for enhanced validation // NewKeyManagerWithChainID creates a key manager with specified chain ID for enhanced validation
func NewKeyManagerWithChainID(config *KeyManagerConfig, logger *logger.Logger, chainID *big.Int) (*KeyManager, error) { func NewKeyManagerWithChainID(config *KeyManagerConfig, logger *logger.Logger, chainID *big.Int) (*KeyManager, error) {
return newKeyManagerInternal(config, logger, chainID, true) // Skip production validation in development/test environments
validateProduction := os.Getenv("GO_ENV") != "development" && os.Getenv("NODE_ENV") != "development" && os.Getenv("NODE_ENV") != "test"
return newKeyManagerInternal(config, logger, chainID, validateProduction)
} }
// newKeyManagerForTesting creates a key manager without production validation (test only) // newKeyManagerForTesting creates a key manager without production validation (test only)