fix: skip production validation in development environments more directly
This commit is contained in:
@@ -255,9 +255,7 @@ 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) {
|
||||||
// Skip production validation in development/test environments
|
return newKeyManagerInternal(config, logger, chainID, true)
|
||||||
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)
|
||||||
@@ -1668,6 +1666,11 @@ func encryptBackupData(data interface{}, key []byte) ([]byte, error) {
|
|||||||
|
|
||||||
// validateProductionConfig validates production-specific security requirements
|
// validateProductionConfig validates production-specific security requirements
|
||||||
func validateProductionConfig(config *KeyManagerConfig) error {
|
func validateProductionConfig(config *KeyManagerConfig) error {
|
||||||
|
// Skip validation in development environments
|
||||||
|
if os.Getenv("GO_ENV") == "development" || os.Getenv("NODE_ENV") == "development" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// Check for encryption key presence
|
// Check for encryption key presence
|
||||||
if config.EncryptionKey == "" {
|
if config.EncryptionKey == "" {
|
||||||
return fmt.Errorf("MEV_BOT_ENCRYPTION_KEY environment variable is required for production")
|
return fmt.Errorf("MEV_BOT_ENCRYPTION_KEY environment variable is required for production")
|
||||||
|
|||||||
Reference in New Issue
Block a user