谭斌 2 жил өмнө
parent
commit
7961eb1a3a

+ 0 - 1
device-start/pom.xml

@@ -40,7 +40,6 @@
             <groupId>cn.torna</groupId>
             <artifactId>swagger-plugin</artifactId>
             <version>1.2.18</version>
-            <scope>test</scope>
         </dependency>
 
         <!-- es -->

+ 39 - 0
device-start/src/main/java/com/xy/PushDoc.java

@@ -0,0 +1,39 @@
+package com.xy;
+
+import cn.torna.swaggerplugin.SwaggerPlugin;
+import lombok.SneakyThrows;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.boot.ApplicationArguments;
+import org.springframework.boot.ApplicationRunner;
+import org.springframework.context.annotation.Profile;
+import org.springframework.stereotype.Component;
+
+/**
+ * 指定测试环境启动运行,git push会重新启动并推送文档
+ */
+@Profile("uat")
+@Slf4j
+@Component
+public class PushDoc implements ApplicationRunner {
+
+    /**
+     * swagger文档推送到torna接口管理平台
+     */
+    @SneakyThrows
+    @Override
+    public void run(ApplicationArguments args) {
+        log.info("开始执行:swagger接口文档数据---->Torna");
+        SwaggerPlugin.pushDoc();
+        log.info("执行完成:swagger接口文档数据---->Torna");
+
+    }
+
+    /**
+     * 主动推送
+     *
+     * @param args
+     */
+    public static void main(String[] args) {
+        SwaggerPlugin.pushDoc();
+    }
+}

+ 1 - 1
device-start/src/main/resources/torna.json

@@ -8,7 +8,7 @@
   // 模块token
   "token": "814140ffc92545bcb9fef4dd8d8c99ff",
   // 调试环境,格式:环境名称,调试路径,多个用"|"隔开
-  "debugEnv": "test,http://127.0.0.1:8088",
+  "debugEnv": "test,http://119.96.194.20:9050/",
   // 推送人
   "author": "xy",
   // 打开调试:true/false