From 17f4fe254ae3d1c56ffbad8770b9d0578204731e Mon Sep 17 00:00:00 2001 From: panlinlin <648540858@qq.com> Date: Fri, 25 Dec 2020 18:11:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AF=B9=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E7=9A=84=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iot/vmp/conf/ApplicationCheckRunner.java | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 src/main/java/com/genersoft/iot/vmp/conf/ApplicationCheckRunner.java diff --git a/src/main/java/com/genersoft/iot/vmp/conf/ApplicationCheckRunner.java b/src/main/java/com/genersoft/iot/vmp/conf/ApplicationCheckRunner.java new file mode 100644 index 00000000..faa9ef12 --- /dev/null +++ b/src/main/java/com/genersoft/iot/vmp/conf/ApplicationCheckRunner.java @@ -0,0 +1,63 @@ +package com.genersoft.iot.vmp.conf; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.CommandLineRunner; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; + + +/** + * 对配置文件进行校验 + */ +@Component +@Order(value=2) +public class ApplicationCheckRunner implements CommandLineRunner { + + private Logger logger = LoggerFactory.getLogger("ApplicationCheckRunner"); + + @Value("${sip.ip}") + private String sipIp; + + @Value("${media.ip}") + private String mediaIp; + + @Value("${media.wanIp}") + private String mediaWanIp; + + @Value("${media.hookIp}") + private String mediaHookIp; + + @Value("${media.port}") + private int mediaPort; + + @Value("${media.secret}") + private String mediaSecret; + + @Value("${media.streamNoneReaderDelayMS}") + private String streamNoneReaderDelayMS; + + @Value("${sip.ip}") + private String sipIP; + + @Value("${server.port}") + private String serverPort; + + @Value("${media.autoConfig}") + private boolean autoConfig; + + + @Override + public void run(String... args) throws Exception { + if (sipIP.equals("localhost") || sipIP.equals("127.0.0.1")) { + logger.error("sip.ip不能使用 {} ,请使用类似192.168.1.44这样的来自网卡的IP!!!", sipIP ); + System.exit(1); + } + + if (mediaIp.equals("localhost") || mediaIp.equals("127.0.0.1")) { + logger.warn("mediaIp.ip使用 {} ,将无法收到网络内其他设备的推流!!!", mediaIp ); + } + + } +}