| | |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.context.ApplicationContextInitializer; |
| | | import org.springframework.context.ConfigurableApplicationContext; |
| | | import org.springframework.core.io.ClassPathResource;
|
| | | import org.springframework.core.io.Resource;
|
| | | import org.springframework.core.io.ResourceLoader;
|
| | | import org.springframework.stereotype.Component; |
| | |
|
| | | import javax.annotation.PostConstruct; |
| | | import javax.annotation.PreDestroy; |
| | | import java.io.File; |
| | | import java.io.IOException;
|
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | |
| | | Boolean webrtcEnabled; |
| | | //redis |
| | | String redisName = "redis-server.exe"; |
| | |
|
| | | /** |
| | | * 程序初始化启动redis |
| | | * 刘苏义 |
| | |
| | | @Override |
| | | public void initialize(ConfigurableApplicationContext applicationContext) { |
| | | if (Platform.isWindows()) { |
| | | String exePath = System.getProperty("user.dir") + File.separator + "lib" + File.separator + "redis" + File.separator + redisName; |
| | | String exePath = System.getProperty("user.dir") + File.separator + "server" + File.separator + "redis" + File.separator + redisName;
|
| | | List<String> cmd = new ArrayList<>(); |
| | | cmd.add(exePath); |
| | | if (CmdUtils.isProcessRunning(redisName)) { |
| | |
| | | if (minioEnabled) { |
| | | log.info("初始化启动minio"); |
| | | if (Platform.isWindows()) { |
| | | String exePath = System.getProperty("user.dir") + File.separator + "lib" + File.separator + "minio" + File.separator + minioName; |
| | | String exePath = System.getProperty("user.dir") + File.separator + "server" + File.separator + "minio" + File.separator + minioName;
|
| | | Map<String, String> env = new HashMap<>(); |
| | | env.put("MINIO_ROOT_USER", accessKey); |
| | | env.put("MINIO_ROOT_PASSWORD", secretKey); |
| | |
| | | if (mediamtxEnabled) { |
| | | log.info("初始化启动mediaMTX"); |
| | | if (Platform.isWindows()) { |
| | | String exePath = System.getProperty("user.dir") + File.separator + "lib" + File.separator + "mediamtx" + File.separator + mediamtxName; |
| | | String ymlPath = System.getProperty("user.dir") + File.separator + "lib" + File.separator + "mediamtx" + File.separator + "mediamtx.yml"; |
| | | String exePath = System.getProperty("user.dir") + File.separator + "server" + File.separator + "mediamtx" + File.separator + mediamtxName;
|
| | | String ymlPath = System.getProperty("user.dir") + File.separator + "server" + File.separator + "mediamtx" + File.separator + "mediamtx.yml";
|
| | | |
| | | List<String> cmd = new ArrayList<>(); |
| | | cmd.add(exePath); |
| | |
| | | if (webrtcEnabled) { |
| | | log.info("初始化启动webrtc-streamer"); |
| | | if (Platform.isWindows()) { |
| | | String exePath = System.getProperty("user.dir") + File.separator + "lib" + File.separator + "webrtc" + File.separator + webrtcName; |
| | | String exePath = System.getProperty("user.dir") + File.separator + "server" + File.separator + "webrtc" + File.separator + webrtcName;
|
| | | List<String> cmd = new ArrayList<>(); |
| | | cmd.add(exePath); |
| | | cmd.add("-H" + webrtcHost); |