diff --git a/src/main/java/com/genersoft/iot/vmp/conf/UserSetup.java b/src/main/java/com/genersoft/iot/vmp/conf/UserSetup.java index 140295e8..8a4c021f 100644 --- a/src/main/java/com/genersoft/iot/vmp/conf/UserSetup.java +++ b/src/main/java/com/genersoft/iot/vmp/conf/UserSetup.java @@ -27,6 +27,8 @@ public class UserSetup { private Boolean logInDatebase = Boolean.TRUE; + private Boolean redisConfig = Boolean.TRUE; + private String serverId = "000000"; private String thirdPartyGBIdReg = "[\\s\\S]*"; @@ -124,4 +126,12 @@ public class UserSetup { public void setThirdPartyGBIdReg(String thirdPartyGBIdReg) { this.thirdPartyGBIdReg = thirdPartyGBIdReg; } + + public Boolean getRedisConfig() { + return redisConfig; + } + + public void setRedisConfig(Boolean redisConfig) { + this.redisConfig = redisConfig; + } } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/event/offline/KeepaliveTimeoutListenerForPlatform.java b/src/main/java/com/genersoft/iot/vmp/gb28181/event/offline/KeepaliveTimeoutListenerForPlatform.java index 08815682..8bbf03ee 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/event/offline/KeepaliveTimeoutListenerForPlatform.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/event/offline/KeepaliveTimeoutListenerForPlatform.java @@ -3,7 +3,9 @@ package com.genersoft.iot.vmp.gb28181.event.offline; import com.genersoft.iot.vmp.conf.UserSetup; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.DependsOn; import org.springframework.data.redis.connection.Message; import org.springframework.data.redis.listener.KeyExpirationEventMessageListener; import org.springframework.data.redis.listener.RedisMessageListenerContainer; @@ -28,10 +30,17 @@ public class KeepaliveTimeoutListenerForPlatform extends KeyExpirationEventMessa @Autowired private UserSetup userSetup; + @Override + public void init() { + if (!userSetup.getRedisConfig()) { + // 配置springboot默认Config为空,即不让应用去修改redis的默认配置,因为Redis服务出于安全会禁用CONFIG命令给远程用户使用 + setKeyspaceNotificationsConfigParameter(""); + } + super.init(); + } + public KeepaliveTimeoutListenerForPlatform(RedisMessageListenerContainer listenerContainer) { super(listenerContainer); - // 配置springboot默认Config为空,即不让应用去修改redis的默认配置,因为Redis服务出于安全会禁用CONFIG命令给远程用户使用 - setKeyspaceNotificationsConfigParameter(""); } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/event/offline/KeepliveTimeoutListener.java b/src/main/java/com/genersoft/iot/vmp/gb28181/event/offline/KeepliveTimeoutListener.java index 95a8ba98..7b3cb589 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/event/offline/KeepliveTimeoutListener.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/event/offline/KeepliveTimeoutListener.java @@ -4,6 +4,8 @@ import com.genersoft.iot.vmp.conf.UserSetup; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.DependsOn; +import org.springframework.context.annotation.Lazy; import org.springframework.data.redis.connection.Message; import org.springframework.data.redis.listener.KeyExpirationEventMessageListener; import org.springframework.data.redis.listener.RedisMessageListenerContainer; @@ -28,10 +30,17 @@ public class KeepliveTimeoutListener extends KeyExpirationEventMessageListener { @Autowired private UserSetup userSetup; + @Override + public void init() { + if (!userSetup.getRedisConfig()) { + // 配置springboot默认Config为空,即不让应用去修改redis的默认配置,因为Redis服务出于安全会禁用CONFIG命令给远程用户使用 + setKeyspaceNotificationsConfigParameter(""); + } + super.init(); + } + public KeepliveTimeoutListener(RedisMessageListenerContainer listenerContainer) { super(listenerContainer); - // 配置springboot默认Config为空,即不让应用去修改redis的默认配置,因为Redis服务出于安全会禁用CONFIG命令给远程用户使用 - setKeyspaceNotificationsConfigParameter(""); } /** diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/event/offline/OfflineEventListener.java b/src/main/java/com/genersoft/iot/vmp/gb28181/event/offline/OfflineEventListener.java index 0f5604c0..9751915e 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/event/offline/OfflineEventListener.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/event/offline/OfflineEventListener.java @@ -5,6 +5,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationListener; +import org.springframework.context.annotation.DependsOn; +import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Component; import com.genersoft.iot.vmp.common.VideoManagerConstants; diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/event/ZLMKeepliveTimeoutListener.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/event/ZLMKeepliveTimeoutListener.java index eaf8bbbb..3fc6a3ca 100644 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/event/ZLMKeepliveTimeoutListener.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/event/ZLMKeepliveTimeoutListener.java @@ -37,10 +37,17 @@ public class ZLMKeepliveTimeoutListener extends KeyExpirationEventMessageListene @Autowired private IMediaServerService mediaServerService; + @Override + public void init() { + if (!userSetup.getRedisConfig()) { + // 配置springboot默认Config为空,即不让应用去修改redis的默认配置,因为Redis服务出于安全会禁用CONFIG命令给远程用户使用 + setKeyspaceNotificationsConfigParameter(""); + } + super.init(); + } + public ZLMKeepliveTimeoutListener(RedisMessageListenerContainer listenerContainer) { super(listenerContainer); - // 配置springboot默认Config为空,即不让应用去修改redis的默认配置,因为Redis服务出于安全会禁用CONFIG命令给远程用户使用 -// setKeyspaceNotificationsConfigParameter(""); } /** diff --git a/src/main/resources/all-application.yml b/src/main/resources/all-application.yml index 20587424..a9d7a080 100644 --- a/src/main/resources/all-application.yml +++ b/src/main/resources/all-application.yml @@ -156,6 +156,8 @@ user-settings: wait-track: false # 是否开启接口鉴权 interface-authentication: true + # 自动配置redis 可以过期事件 + redis-config: true # 接口鉴权例外的接口, 即不进行接口鉴权的接口,尽量详细书写,尽量不用/**,至少两级目录 interface-authentication-excludes: - /api/v1/**