Authored by zhouxiang

nginx lua切换

@@ -14,8 +14,8 @@ import java.util.Map; @@ -14,8 +14,8 @@ import java.util.Map;
14 public class HandlebarsUtils { 14 public class HandlebarsUtils {
15 private static Handlebars handlebars = new Handlebars(); 15 private static Handlebars handlebars = new Handlebars();
16 static { 16 static {
17 - handlebars.setStartDelimiter("<<<");  
18 - handlebars.setEndDelimiter(">>>"); 17 + handlebars.setStartDelimiter("{@{");
  18 + handlebars.setEndDelimiter("}@}");
19 } 19 }
20 20
21 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) {
@@ -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
@@ -18,7 +18,7 @@ public class CommodUtil { @@ -18,7 +18,7 @@ public class CommodUtil {
18 private static Logger logger = LoggerFactory.getLogger(CommodUtil.class); 18 private static Logger logger = LoggerFactory.getLogger(CommodUtil.class);
19 19
20 20
21 - public static final String BASE_DIR = "/bin/sh " + System.getenv("HOME") + "/ops_sh/"; 21 + public static final String BASE_DIR = System.getenv("HOME") + "/ops_sh/";
22 22
23 /** 23 /**
24 * NGINX 查询切换脚本 24 * NGINX 查询切换脚本