Authored by zhouxiang

no message

@@ -13,6 +13,10 @@ import java.util.Map; @@ -13,6 +13,10 @@ import java.util.Map;
13 */ 13 */
14 public class HandlebarsUtils { 14 public class HandlebarsUtils {
15 private static Handlebars handlebars = new Handlebars(); 15 private static Handlebars handlebars = new Handlebars();
  16 + static {
  17 + handlebars.setStartDelimiter("<<<");
  18 + handlebars.setEndDelimiter(">>>");
  19 + }
16 20
17 public static String replace(Map<String, Object> obj,String tempfilePath,String createFileName) { 21 public static String replace(Map<String, Object> obj,String tempfilePath,String createFileName) {
18 String result = ""; 22 String result = "";
@@ -114,14 +114,14 @@ http @@ -114,14 +114,14 @@ http
114 114
115 115
116 upstream apigateway { 116 upstream apigateway {
117 - {{#each ips}}server {{this}}:8080 max_fails=5 fail_timeout=3s;  
118 - {{/each}} 117 + <<<#each ips>>>server <<<this>>>:8080 max_fails=5 fail_timeout=3s;
  118 + <<</each>>>
119 keepalive 32; 119 keepalive 32;
120 } 120 }
121 121
122 upstream grayapigateway { 122 upstream grayapigateway {
123 - {{#each grayips}}server {{this}}:8080 max_fails=5 fail_timeout=3s;  
124 - {{/each}} 123 + <<<#each grayips>>>server <<<this>>>:8080 max_fails=5 fail_timeout=3s;
  124 + <<</each>>>
125 keepalive 32; 125 keepalive 32;
126 } 126 }
127 127
@@ -7,7 +7,7 @@ local context=ngx.lookup_context @@ -7,7 +7,7 @@ local context=ngx.lookup_context
7 context.dns_server={"114.114.114.114"} 7 context.dns_server={"114.114.114.114"}
8 8
9 -- 1:aws ,2:qq ,3:aws+qq 9 -- 1:aws ,2:qq ,3:aws+qq
10 -context.cloud_flag={{flag}} 10 +context.cloud_flag=<<<flag>>>
11 11
12 --add 20160823 notLogin=aws/tencent 12 --add 20160823 notLogin=aws/tencent
13 context.strategy_param={["model"]=1024,["tencentMax"]=128,["notLogin"]="aws"} 13 context.strategy_param={["model"]=1024,["tencentMax"]=128,["notLogin"]="aws"}
@@ -112,15 +112,15 @@ http @@ -112,15 +112,15 @@ http
112 } 112 }
113 113
114 upstream apigateway { 114 upstream apigateway {
115 - {{#each ips}}server {{this}}:8080 max_fails=5 fail_timeout=3s;  
116 - {{/each}} 115 + {{#each ips>>>server <<<this>>>:8080 max_fails=5 fail_timeout=3s;
  116 + <<</each>>>
117 keepalive 32; 117 keepalive 32;
118 } 118 }
119 119
120 upstream grayapigateway{ 120 upstream grayapigateway{
121 # ip_hash; 121 # ip_hash;
122 - {{#each grayips}}server {{this}}:8080 max_fails=5 fail_timeout=3s;  
123 - {{/each}} 122 + <<<#each grayips>>>server <<<this>>>:8080 max_fails=5 fail_timeout=3s;
  123 + <<</each>>>
124 keepalive 32; 124 keepalive 32;
125 } 125 }
126 126
@@ -65,14 +65,14 @@ public class LuaSwitchCtrl { @@ -65,14 +65,14 @@ public class LuaSwitchCtrl {
65 * 65 *
66 * @return 2016年5月12日下午1:49:48 66 * @return 2016年5月12日下午1:49:48
67 */ 67 */
68 - @RequestMapping(value = "viewToChangeLuaConf") 68 + @RequestMapping(value = "viewToChangeLuaConf")
69 @ResponseBody 69 @ResponseBody
70 public BaseResponse viewToChangeLuaConf(String cloudName, HttpServletRequest request) { 70 public BaseResponse viewToChangeLuaConf(String cloudName, HttpServletRequest request) {
71 logger.info("cloudName {}",cloudName); 71 logger.info("cloudName {}",cloudName);
72 Map<String,Object> map = new HashMap(); 72 Map<String,Object> map = new HashMap();
73 map.put("flag", StringUtils.equals("aws",cloudName) ? 1 : (StringUtils.equals("qcloud",cloudName) ? 2 : 3)); 73 map.put("flag", StringUtils.equals("aws",cloudName) ? 1 : (StringUtils.equals("qcloud",cloudName) ? 2 : 3));
74 String path = request.getSession().getServletContext().getRealPath("/") + "lua/dns_resolver_worker.lua"; 74 String path = request.getSession().getServletContext().getRealPath("/") + "lua/dns_resolver_worker.lua";
75 - String result = HandlebarsUtils.replace(map,"dns_resolver_worker",path); 75 + String result = HandlebarsUtils.replace(map,"template/dns_resolver_worker",path);
76 return new BaseResponse(200,"success",result); 76 return new BaseResponse(200,"success",result);
77 } 77 }
78 78