Showing
1 changed file
with
21 additions
and
3 deletions
@@ -98,9 +98,27 @@ public class GrayNginxSwitchCtrl { | @@ -98,9 +98,27 @@ public class GrayNginxSwitchCtrl { | ||
98 | @RequestMapping(value = "/viewGrayNginxToChangeConf") | 98 | @RequestMapping(value = "/viewGrayNginxToChangeConf") |
99 | @ResponseBody | 99 | @ResponseBody |
100 | public BaseResponse viewGrayNginxToChangeConf(String onlineOrGray) { | 100 | public BaseResponse viewGrayNginxToChangeConf(String onlineOrGray) { |
101 | - String nginxConfContent=exe(" -eview -n"+grayNginxAddress); | ||
102 | - | ||
103 | - | 101 | + // String nginxConfContent=exe(" -eview -n"+grayNginxAddress); |
102 | + StringBuilder sb = new StringBuilder(); | ||
103 | + BufferedReader input = null; | ||
104 | + try { | ||
105 | + input = new BufferedReader(new FileReader(new File(FILE_PATH))); | ||
106 | + String line ; | ||
107 | + while ((line = input.readLine()) != null) { | ||
108 | + sb.append(line + "\r\n"); | ||
109 | + } | ||
110 | + } catch (Exception e) { | ||
111 | + logger.error(" process exe failed!", e); | ||
112 | + } finally { | ||
113 | + if (input != null) { | ||
114 | + try { | ||
115 | + input.close(); | ||
116 | + } catch (IOException e) { | ||
117 | + logger.error("process exe failed!", e); | ||
118 | + } | ||
119 | + } | ||
120 | + } | ||
121 | + String nginxConfContent= sb.toString(); | ||
104 | nginxConfContent = replaceConf(nginxConfContent,onlineOrGray," grayapigateway"); | 122 | nginxConfContent = replaceConf(nginxConfContent,onlineOrGray," grayapigateway"); |
105 | //" apigateway"一定要有一个空格在前面 | 123 | //" apigateway"一定要有一个空格在前面 |
106 | nginxConfContent = replaceConf(nginxConfContent,onlineOrGray," apigateway"); | 124 | nginxConfContent = replaceConf(nginxConfContent,onlineOrGray," apigateway"); |
-
Please register or login to post a comment