[GitHub] [apisix-dashboard] juzhiyuan commented on issue #385: My dashboard is not working

2020-08-23 Thread GitBox


juzhiyuan commented on issue #385:
URL: 
https://github.com/apache/apisix-dashboard/issues/385#issuecomment-678913850


   @gxthrj Please take a look, thanks



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [apisix] Yiyiyimu commented on issue #2110: request help: move `conf/cert` to `t/cert`

2020-08-23 Thread GitBox


Yiyiyimu commented on issue #2110:
URL: https://github.com/apache/apisix/issues/2110#issuecomment-678908901


   > we shoule remove this line :)
   
   Sure thx



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [apisix] Yiyiyimu opened a new pull request #2112: fix: move `conf/cert` to `t/certs`

2020-08-23 Thread GitBox


Yiyiyimu opened a new pull request #2112:
URL: https://github.com/apache/apisix/pull/2112


   ### What this PR does / why we need it:
   fix #2110 
   
   ### Pre-submission checklist:
   
   * [x] Did you explain what problem does this PR solve? Or what new features 
have been added?
   * [ ] Have you added corresponding test cases?
   * [ ] Have you modified the corresponding document?
   * [x] Is this PR backward compatible?
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [apisix] moonming commented on issue #2110: request help: move `conf/cert` to `t/cert`

2020-08-23 Thread GitBox


moonming commented on issue #2110:
URL: https://github.com/apache/apisix/issues/2110#issuecomment-678877337


   > Do we also need to change the path in Makefile?
   > 
   > 
https://github.com/apache/apisix/blob/1aefe915f1a01ff7d068cfe7013676bfece2d43e/Makefile#L124
   
   we shoule remove this line :)



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [apisix] Yiyiyimu commented on issue #2110: request help: move `conf/cert` to `t/cert`

2020-08-23 Thread GitBox


Yiyiyimu commented on issue #2110:
URL: https://github.com/apache/apisix/issues/2110#issuecomment-678876252


   Do we also need to change the path in Makefile?
   
https://github.com/apache/apisix/blob/1aefe915f1a01ff7d068cfe7013676bfece2d43e/Makefile#L124



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [apisix-dashboard] lijiapengsa opened a new issue #392: How to judge whether `manager-api` has been started successfully

2020-08-23 Thread GitBox


lijiapengsa opened a new issue #392:
URL: https://github.com/apache/apisix-dashboard/issues/392


   Please answer these questions before submitting your issue.
   
   - Why do you submit this issue?
   - [x] Question or discussion
   - [ ] Bug
   - [ ] Requirements
   - [ ] Feature or performance improvement
   - [ ] Other
   
   ___
   ### Question
   - What do you want to know?
   
   Has the manager-api started successfully? No output. Is manager-api 
listening on the port or starting a process?
   
   
![image](https://user-images.githubusercontent.com/7970836/90998771-791f5200-e5f7-11ea-9949-56d91bc900d6.png)
   
   ___
   ### Bug
   - Which version of Apache APISIX Dashboard, OS and Broswer?
   apisix 1.5
   Centos7
   
   - What happened?
   If possible, provide a way to reproduce the error.
   
   ___
   ### Requirement or improvement
   - Please describe your requirements or improvement suggestions.
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [apisix-dashboard] lijiapengsa commented on issue #385: My dashboard is not working

2020-08-23 Thread GitBox


lijiapengsa commented on issue #385:
URL: 
https://github.com/apache/apisix-dashboard/issues/385#issuecomment-678874468


   For the time being, I don't worry about the error of dashboard.
   
   Has the manager-api started successfully? No output. Is `manager-api` 
listening on the port or starting a process?
   
   
![image](https://user-images.githubusercontent.com/7970836/90998212-26916600-e5f6-11ea-822e-82b9a51d2846.png)
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [apisix] Yiyiyimu commented on a change in pull request #2101: feature: customed config.yaml when apisix start

2020-08-23 Thread GitBox


Yiyiyimu commented on a change in pull request #2101:
URL: https://github.com/apache/apisix/pull/2101#discussion_r475309706



##
File path: bin/apisix
##
@@ -940,6 +940,22 @@ function _M.start(...)
 end
 end
 
+local argparse = require "argparse"
+local parser = argparse()
+parser:argument("_", "Placeholder")
+parser:option("-c --config", "location of customed config.yaml")
+local args = parser:parse()
+local customed_yaml = args["config"]
+
+local profile = require("apisix.core.profile")
+profile.apisix_home = apisix_home .. "/"
+local local_conf_path = profile:yaml_path("config")
+
+if customed_yaml then
+local cmd = "cp " .. customed_yaml .. " " .. local_conf_path

Review comment:
   I got it. I'll change it





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [apisix] Yiyiyimu commented on a change in pull request #2101: feature: customed config.yaml when apisix start

2020-08-23 Thread GitBox


Yiyiyimu commented on a change in pull request #2101:
URL: https://github.com/apache/apisix/pull/2101#discussion_r475309509



##
File path: rockspec/apisix-master-0.rockspec
##
@@ -52,6 +52,7 @@ dependencies = {
 "lua-resty-kafka = 0.07",
 "lua-resty-logger-socket = 2.0-0",
 "skywalking-nginx-lua-plugin = 1.0-0",
+"argparse = 0.7.1-1",

Review comment:
   MIT License, and it is currently maintained by luarocks community.





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [apisix] nic-chen opened a new issue #2111: bug: plugins should not exit by itself

2020-08-23 Thread GitBox


nic-chen opened a new issue #2111:
URL: https://github.com/apache/apisix/issues/2111


   ### Issue description
   plugins should not exit by itself in access and rewrite phase, it can't be 
reuse in `script`, and the plugin engine has already covered:
   
   https://github.com/apache/apisix/blob/master/apisix/init.lua#L134
   
   
   ### Environment
   
   * apisix version (cmd: `apisix version`): 1.5
   * OS:
   
   ### Minimal test code / Steps to reproduce the issue
   1.
   2.
   3.
   
   ### What's the actual result? (including assertion message & call stack if 
applicable)
   
   exit by plugin engine
   
   ### What's the expected result?
   
   exit by itself
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [apisix] moonming closed issue #2085: request help: Update plugin's schema ip-restriction

2020-08-23 Thread GitBox


moonming closed issue #2085:
URL: https://github.com/apache/apisix/issues/2085


   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[apisix] branch master updated: change: update plugin's schema ip-restriction with `draft7` way (#2091)

2020-08-23 Thread wenming
This is an automated email from the ASF dual-hosted git repository.

wenming pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new 1aefe91  change: update plugin's schema ip-restriction with `draft7` 
way (#2091)
1aefe91 is described below

commit 1aefe915f1a01ff7d068cfe7013676bfece2d43e
Author: YuanSheng Wang 
AuthorDate: Mon Aug 24 09:27:49 2020 +0800

change: update plugin's schema ip-restriction with `draft7` way (#2091)
---
 apisix/plugins/ip-restriction.lua | 36 +++-
 apisix/schema_def.lua |  8 
 t/plugin/ip-restriction.t |  6 +++---
 3 files changed, 30 insertions(+), 20 deletions(-)

diff --git a/apisix/plugins/ip-restriction.lua 
b/apisix/plugins/ip-restriction.lua
index f08c9c7..2dead12 100644
--- a/apisix/plugins/ip-restriction.lua
+++ b/apisix/plugins/ip-restriction.lua
@@ -27,21 +27,31 @@ local lrucache  = core.lrucache.new({
 
 local schema = {
 type = "object",
-properties = {
-whitelist = {
-type = "array",
-items = {type = "string", anyOf = core.schema.ip_def},
-minItems = 1
+oneOf = {
+{
+title = "whitelist",
+properties = {
+whitelist = {
+type = "array",
+items = {anyOf = core.schema.ip_def},
+minItems = 1
+},
+},
+required = {"whitelist"},
+additionalProperties = false,
 },
-blacklist = {
-type = "array",
-items = {type = "string", anyOf = core.schema.ip_def},
-minItems = 1
+{
+title = "blacklist",
+properties = {
+blacklist = {
+type = "array",
+items = {anyOf = core.schema.ip_def},
+minItems = 1
+}
+},
+required = {"blacklist"},
+additionalProperties = false,
 }
-},
-oneOf = {
-{required = {"whitelist"}},
-{required = {"blacklist"}}
 }
 }
 
diff --git a/apisix/schema_def.lua b/apisix/schema_def.lua
index 222938b..ef234c0 100644
--- a/apisix/schema_def.lua
+++ b/apisix/schema_def.lua
@@ -49,10 +49,10 @@ local ipv4_def = 
"[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}"
 local ipv6_def = "([a-fA-F0-9]{0,4}:){0,8}(:[a-fA-F0-9]{0,4}){0,8}"
  .. "([a-fA-F0-9]{0,4})?"
 local ip_def = {
-{pattern = "^" .. ipv4_def .. "$"},
-{pattern = "^" .. ipv4_def .. "/[0-9]{1,2}$"},
-{pattern = "^" .. ipv6_def .. "$"},
-{pattern = "^" .. ipv6_def .. "/[0-9]{1,3}$"},
+{title = "IPv4", type = "string", pattern = "^" .. ipv4_def .. "$"},
+{title = "IPv4/CIDR", type = "string", pattern = "^" .. ipv4_def .. 
"/[0-9]{1,2}$"},
+{title = "IPv6", type = "string", pattern = "^" .. ipv6_def .. "$"},
+{title = "IPv6/CIDR", type = "string", pattern = "^" .. ipv6_def .. 
"/[0-9]{1,3}$"},
 }
 _M.ip_def = ip_def
 
diff --git a/t/plugin/ip-restriction.t b/t/plugin/ip-restriction.t
index 9403819..58b0aee 100644
--- a/t/plugin/ip-restriction.t
+++ b/t/plugin/ip-restriction.t
@@ -160,7 +160,7 @@ done
 --- request
 GET /t
 --- response_body
-property "blacklist" validation failed: expect array to have at least 1 items
+value should match only one schema, but matches none
 done
 --- no_error_log
 [error]
@@ -183,7 +183,7 @@ done
 --- request
 GET /t
 --- response_body
-value should match only one schema, but matches both schemas 1 and 2
+value should match only one schema, but matches none
 done
 --- no_error_log
 [error]
@@ -565,6 +565,6 @@ GET /hello
 GET /t
 --- response_body
 invalid ip address: ::1/129
-property "whitelist" validation failed: failed to validate item 1: object 
matches none of the requireds
+value should match only one schema, but matches none
 --- no_error_log
 [error]



[GitHub] [apisix] moonming merged pull request #2091: change: update plugin's schema ip-restriction with `draft7` way

2020-08-23 Thread GitBox


moonming merged pull request #2091:
URL: https://github.com/apache/apisix/pull/2091


   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [apisix] moonming commented on pull request #2090: change: set the default value by jsonshema .

2020-08-23 Thread GitBox


moonming commented on pull request #2090:
URL: https://github.com/apache/apisix/pull/2090#issuecomment-678858348


   the same as 
https://github.com/apache/apisix/commit/415f9221e22db0cd599926ca3b5f98a55f2693b4



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [apisix] moonming closed pull request #2090: change: set the default value by jsonshema .

2020-08-23 Thread GitBox


moonming closed pull request #2090:
URL: https://github.com/apache/apisix/pull/2090


   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[apisix] branch master updated: feature: support multiple certificates(RSA and ECC) for single domain (#2089)

2020-08-23 Thread wenming
This is an automated email from the ASF dual-hosted git repository.

wenming pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new 2886b21  feature: support multiple certificates(RSA and ECC) for 
single domain (#2089)
2886b21 is described below

commit 2886b2169b67a729bcd58807572e9c849464797e
Author: Alex Zhang 
AuthorDate: Mon Aug 24 09:23:06 2020 +0800

feature: support multiple certificates(RSA and ECC) for single domain 
(#2089)
---
 apisix/admin/ssl.lua |   6 ++
 apisix/http/router/radixtree_sni.lua |  18 -
 apisix/schema_def.lua|  16 +
 conf/cert/apisix_ecc.crt |  13 
 conf/cert/apisix_ecc.key |   8 +++
 doc/https.md |  17 -
 doc/zh-cn/https.md   |  10 +++
 t/APISIX.pm  |   6 ++
 t/admin/ssl.t|  89 
 t/router/radixtree-sni.t | 131 +++
 10 files changed, 311 insertions(+), 3 deletions(-)

diff --git a/apisix/admin/ssl.lua b/apisix/admin/ssl.lua
index 6d9307d..f102f27 100644
--- a/apisix/admin/ssl.lua
+++ b/apisix/admin/ssl.lua
@@ -54,6 +54,12 @@ local function check_conf(id, conf, need_id)
 return nil, {error_msg = "invalid configuration: " .. err}
 end
 
+local numcerts = conf.certs and #conf.certs or 0
+local numkeys = conf.keys and #conf.keys or 0
+if numcerts ~= numkeys then
+return nil, {error_msg = "mismatched number of certs and keys"}
+end
+
 return need_id and id or true
 end
 
diff --git a/apisix/http/router/radixtree_sni.lua 
b/apisix/http/router/radixtree_sni.lua
index 4c7843b..0663336 100644
--- a/apisix/http/router/radixtree_sni.lua
+++ b/apisix/http/router/radixtree_sni.lua
@@ -115,8 +115,6 @@ local function set_pem_ssl_key(cert, pkey)
 return false, "no request found"
 end
 
-ngx_ssl.clear_certs()
-
 local parse_cert, err = ngx_ssl.parse_pem_cert(cert)
 if parse_cert then
 local ok, err = ngx_ssl.set_cert(parse_cert)
@@ -195,11 +193,27 @@ function _M.match_and_set(api_ctx)
 
 local matched_ssl = api_ctx.matched_ssl
 core.log.info("debug - matched: ", core.json.delay_encode(matched_ssl, 
true))
+
+ngx_ssl.clear_certs()
+
 ok, err = set_pem_ssl_key(matched_ssl.value.cert, matched_ssl.value.key)
 if not ok then
 return false, err
 end
 
+-- multiple certificates support.
+if matched_ssl.value.certs then
+for i = 1, #matched_ssl.value.certs do
+local cert = matched_ssl.value.certs[i]
+local key = matched_ssl.value.keys[i]
+
+ok, err = set_pem_ssl_key(cert, key)
+if not ok then
+return false, err
+end
+end
+end
+
 return true
 end
 
diff --git a/apisix/schema_def.lua b/apisix/schema_def.lua
index 9e4604f..222938b 100644
--- a/apisix/schema_def.lua
+++ b/apisix/schema_def.lua
@@ -516,6 +516,22 @@ _M.ssl = {
 pattern = [[^\*?[0-9a-zA-Z-.]+$]],
 }
 },
+certs = {
+type = "array",
+items = {
+type = "string",
+minLength = 128,
+maxLength = 64*1024,
+}
+},
+keys = {
+type = "array",
+items = {
+type = "string",
+minLength = 128,
+maxLength = 64*1024,
+}
+},
 exptime = {
 type = "integer",
 minimum = 1588262400,  -- 2020/5/1 0:0:0
diff --git a/conf/cert/apisix_ecc.crt b/conf/cert/apisix_ecc.crt
new file mode 100644
index 000..b40240e
--- /dev/null
+++ b/conf/cert/apisix_ecc.crt
@@ -0,0 +1,13 @@
+-BEGIN CERTIFICATE-
+MIIB8jCCAZmgAwIBAgIJALwxr+GMOgSKMAoGCCqGSM49BAMCMFYxCzAJBgNVBAYT
+AkNOMRIwEAYDVQQIDAlHdWFuZ0RvbmcxDzANBgNVBAcMBlpodUhhaTEPMA0GA1UE
+CgwGaXJlc3R5MREwDwYDVQQDDAh0ZXN0LmNvbTAeFw0yMDA4MTgwODI0MzdaFw0y
+MTA4MTgwODI0MzdaMFYxCzAJBgNVBAYTAkNOMRIwEAYDVQQIDAlHdWFuZ0Rvbmcx
+DzANBgNVBAcMBlpodUhhaTEPMA0GA1UECgwGaXJlc3R5MREwDwYDVQQDDAh0ZXN0
+LmNvbTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABEJACTxb5qYd4v9VaNKlv2fe
+XlZSTDYe+0fZwT4l9sifmPzmpwjiVTB2wLiCYYzy+BPrb29r5ubgtXIflsWKRBKj
+UDBOMB0GA1UdDgQWBBQPXxOYAHfboUjsoo1xm6/GJ1qHijAfBgNVHSMEGDAWgBQP
+XxOYAHfboUjsoo1xm6/GJ1qHijAMBgNVHRMEBTADAQH/MAoGCCqGSM49BAMCA0cA
+MEQCICQ70LiJ+Z2lv9ZF+FQL+VEdVQ938rz6RGXBmnl2oEvkAiBY2eeTl//JanNX
+GsSV104WrpHjcBjcY24jb11Y1H3R9g==
+-END CERTIFICATE-
diff --git a/conf/cert/apisix_ecc.key b/conf/cert/apisix_ecc.key
new file mode 100644
index 000..984f3ea
--- /dev/null
+++ b/conf/cert/apisix_ecc.key
@@ -0,0 +1,8 @@
+-BEGIN EC PARAMETERS-
+BggqhkjOPQMBBw==
+-END EC PARAMETERS-
+-BEGIN EC PRIVATE KEY-
+MHcCAQEEIBlQqVD3bK6CQT5puOOngrb50+3K66MKJdhtpWQoUw2poAoGCCqGSM49

[GitHub] [apisix] moonming merged pull request #2089: feature: multiple certificates support for single domain

2020-08-23 Thread GitBox


moonming merged pull request #2089:
URL: https://github.com/apache/apisix/pull/2089


   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [apisix] moonming opened a new issue #2110: request help: move `conf/cert` to `t/cert`

2020-08-23 Thread GitBox


moonming opened a new issue #2110:
URL: https://github.com/apache/apisix/issues/2110


   all of these files are ONLY for test cases.



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [apisix] moonming closed issue #2086: request help: Update plugin's schema limit-count

2020-08-23 Thread GitBox


moonming closed issue #2086:
URL: https://github.com/apache/apisix/issues/2086


   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [apisix] moonming merged pull request #2102: change: use draft7 for JSON Schema

2020-08-23 Thread GitBox


moonming merged pull request #2102:
URL: https://github.com/apache/apisix/pull/2102


   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[apisix] branch master updated: change: use draft7 of JSON Schema for limit count pulgin (#2102)

2020-08-23 Thread wenming
This is an automated email from the ASF dual-hosted git repository.

wenming pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new 415f922  change: use draft7 of JSON Schema for limit count pulgin 
(#2102)
415f922 is described below

commit 415f9221e22db0cd599926ca3b5f98a55f2693b4
Author: YuanSheng Wang 
AuthorDate: Mon Aug 24 09:17:31 2020 +0800

change: use draft7 of JSON Schema for limit count pulgin (#2102)
---
 apisix/plugins/limit-count.lua | 63 +++---
 t/plugin/limit-count-redis.t   |  2 +-
 2 files changed, 41 insertions(+), 24 deletions(-)

diff --git a/apisix/plugins/limit-count.lua b/apisix/plugins/limit-count.lua
index 3e9d4af..216b82d 100644
--- a/apisix/plugins/limit-count.lua
+++ b/apisix/plugins/limit-count.lua
@@ -34,27 +34,51 @@ local schema = {
 enum = {"remote_addr", "server_addr", "http_x_real_ip",
 "http_x_forwarded_for"},
 },
-rejected_code = {type = "integer", minimum = 200, maximum = 600,
- default = 503},
+rejected_code = {
+type = "integer", minimum = 200, maximum = 600,
+default = 503
+},
 policy = {
 type = "string",
 enum = {"local", "redis"},
-},
-redis_host = {
-type = "string", minLength = 2
-},
-redis_port = {
-type = "integer", minimum = 1
-},
-redis_password = {
-type = "string", minLength = 0
-},
-redis_timeout = {
-type = "integer", minimum = 1
-},
+default = "local",
+}
 },
-additionalProperties = false,
 required = {"count", "time_window", "key"},
+dependencies = {
+policy = {
+oneOf = {
+{
+properties = {
+policy = {
+enum = {"local"},
+},
+},
+},
+{
+properties = {
+policy = {
+enum = {"redis"},
+},
+redis_host = {
+type = "string", minLength = 2
+},
+redis_port = {
+type = "integer", minimum = 1, default = 6379,
+},
+redis_password = {
+type = "string", minLength = 0,
+},
+redis_timeout = {
+type = "integer", minimum = 1,
+default = 1000,
+},
+},
+required = {"redis_host"},
+}
+}
+}
+}
 }
 
 
@@ -72,17 +96,10 @@ function _M.check_schema(conf)
 return false, err
 end
 
-if not conf.policy then
-conf.policy = "local"
-end
-
 if conf.policy == "redis" then
 if not conf.redis_host then
 return false, "missing valid redis option host"
 end
-
-conf.redis_port = conf.redis_port or 6379
-conf.redis_timeout = conf.redis_timeout or 1000
 end
 
 return true
diff --git a/t/plugin/limit-count-redis.t b/t/plugin/limit-count-redis.t
index 6959af9..f87478f 100644
--- a/t/plugin/limit-count-redis.t
+++ b/t/plugin/limit-count-redis.t
@@ -71,7 +71,7 @@ __DATA__
 GET /t
 --- error_code: 400
 --- response_body
-{"error_msg":"failed to check the configuration of plugin limit-count err: 
missing valid redis option host"}
+{"error_msg":"failed to check the configuration of plugin limit-count err: 
failed to validate dependent schema for \"policy\": value should match only one 
schema, but matches none"}
 --- no_error_log
 [error]
 



[apisix] branch master updated: doc: add dashboard link in README to sync (#2107)

2020-08-23 Thread wenming
This is an automated email from the ASF dual-hosted git repository.

wenming pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new 403c120  doc: add dashboard link in README to sync (#2107)
403c120 is described below

commit 403c1204db0d165962968bc38c74f4bdb6954af0
Author: Shuyang Wu 
AuthorDate: Mon Aug 24 09:12:55 2020 +0800

doc: add dashboard link in README to sync (#2107)
---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 81e4633..9f6d3d2 100644
--- a/README.md
+++ b/README.md
@@ -210,7 +210,7 @@ etcd --enable-v2=true &
 For more documents, please refer to [Apache APISIX Document 
Index](doc/README.md)
 
 ## Dashboard
-APISIX has built-in support for Dashboard,
+APISIX has built-in support for 
[Dashboard](https://github.com/apache/apisix-dashboard), which could be 
directly deployed by docker compose.
 
 The dashboard only allows 127.0.0.1 by default, and you can modify 
`allow_admin` in `conf/config.yaml` by yourself, to list the list of IPs 
allowed to access.
 



[GitHub] [apisix] moonming merged pull request #2107: doc: add dashboard link in README to sync

2020-08-23 Thread GitBox


moonming merged pull request #2107:
URL: https://github.com/apache/apisix/pull/2107


   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [apisix] moonming commented on a change in pull request #2101: feature: customed config.yaml when apisix start

2020-08-23 Thread GitBox


moonming commented on a change in pull request #2101:
URL: https://github.com/apache/apisix/pull/2101#discussion_r475294814



##
File path: rockspec/apisix-master-0.rockspec
##
@@ -52,6 +52,7 @@ dependencies = {
 "lua-resty-kafka = 0.07",
 "lua-resty-logger-socket = 2.0-0",
 "skywalking-nginx-lua-plugin = 1.0-0",
+"argparse = 0.7.1-1",

Review comment:
   what's the license of `argparse`?





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [apisix] moonming commented on issue #2041: failed to fetch service configuration by id

2020-08-23 Thread GitBox


moonming commented on issue #2041:
URL: https://github.com/apache/apisix/issues/2041#issuecomment-678854318


   @lchoua ping



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [apisix] moonming closed issue #1438: [HELP]: how to install APISIX without a network

2020-08-23 Thread GitBox


moonming closed issue #1438:
URL: https://github.com/apache/apisix/issues/1438


   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [apisix] moonming closed issue #2024: feature: customize error code & message for some plugins

2020-08-23 Thread GitBox


moonming closed issue #2024:
URL: https://github.com/apache/apisix/issues/2024


   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [apisix] moonming commented on issue #2057: request help: rpm包方式安装apisix 1.5后,访问admin api 404.

2020-08-23 Thread GitBox


moonming commented on issue #2057:
URL: https://github.com/apache/apisix/issues/2057#issuecomment-678853264


   @tongorz 
   Please use English in the public channel, thx



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [apisix] moonming commented on pull request #1875: [WIP] bugfix: check plugin schema when sync data

2020-08-23 Thread GitBox


moonming commented on pull request #1875:
URL: https://github.com/apache/apisix/pull/1875#issuecomment-678853153


   @wrl96 ping



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [apisix] membphis commented on a change in pull request #2101: feature: customed config.yaml when apisix start

2020-08-23 Thread GitBox


membphis commented on a change in pull request #2101:
URL: https://github.com/apache/apisix/pull/2101#discussion_r475276226



##
File path: bin/apisix
##
@@ -940,6 +940,22 @@ function _M.start(...)
 end
 end
 
+local argparse = require "argparse"
+local parser = argparse()
+parser:argument("_", "Placeholder")
+parser:option("-c --config", "location of customed config.yaml")
+local args = parser:parse()
+local customed_yaml = args["config"]
+
+local profile = require("apisix.core.profile")
+profile.apisix_home = apisix_home .. "/"
+local local_conf_path = profile:yaml_path("config")
+
+if customed_yaml then
+local cmd = "cp " .. customed_yaml .. " " .. local_conf_path

Review comment:
   We should allow users to start two APISIX instances, this way is wrong.





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [apisix] Yiyiyimu opened a new pull request #2109: doc: add more companies to power-by page

2020-08-23 Thread GitBox


Yiyiyimu opened a new pull request #2109:
URL: https://github.com/apache/apisix/pull/2109


   ### What this PR does / why we need it:
   Update since #1317. Need to update image @moonming. 
   Also, do we need to sync the image here and 
[README](https://github.com/apache/apisix#who-uses-apisix)
   
   ### Pre-submission checklist:
   
   * [x] Did you explain what problem does this PR solve? Or what new features 
have been added?
   * [ ] Have you added corresponding test cases?
   * [x] Have you modified the corresponding document?
   * [x] Is this PR backward compatible?
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[apisix-dashboard] branch master updated: doc: Introducing manager-api (#391)

2020-08-23 Thread juzhiyuan
This is an automated email from the ASF dual-hosted git repository.

juzhiyuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git


The following commit(s) were added to refs/heads/master by this push:
 new e50804d  doc: Introducing manager-api (#391)
e50804d is described below

commit e50804db3acc216c21cef5bbbc6ef1d364776948
Author: kv 
AuthorDate: Sun Aug 23 22:41:45 2020 +0800

doc: Introducing manager-api (#391)
---
 README.md  |   3 +++
 images/manager-api.png | Bin 0 -> 44615 bytes
 manager-api.md |  37 +
 3 files changed, 40 insertions(+)

diff --git a/README.md b/README.md
index c8327ec..f40427c 100644
--- a/README.md
+++ b/README.md
@@ -111,3 +111,6 @@ $ yarn start
 ## Other
 
 1. If you need the dashboard-1.0 which is built with Vue.js, please refer to 
[master-vue](https://github.com/apache/apisix-dashboard/tree/master-vue).
+
+2. More information about the new dashboard and manager-api please refer to 
[here](./manager-api.md)
+
diff --git a/images/manager-api.png b/images/manager-api.png
new file mode 100644
index 000..460c87e
Binary files /dev/null and b/images/manager-api.png differ
diff --git a/manager-api.md b/manager-api.md
new file mode 100644
index 000..994685b
--- /dev/null
+++ b/manager-api.md
@@ -0,0 +1,37 @@
+
+
+# Apache APISIX Dashboard
+
+## the relation between dashboard and manager-api
+
+At present, the dashboard is divided into two parts, one is the front-end page 
and script, and the other is the manager that takes over the front-end api 
interface.
+
+Compared with the previous apisix-dashboard, we have one more manager module, 
which is used to encapsulate the apisix admin api, which is more suitable for 
page element display.
+
+The module call relationship is as follows
+
+![manager-api](./images/manager-api.png)
+
+The manager-api has its own storage. The currently used mysql, mysql stores 
some management information other than APISIX internal objects.
+
+When deploying dashboard, we are divided into 3 modules, namely dashboard 
page, manager-api, and the mysql database that manager-api depends on. The 
purple part in the figure is the two new modules added this time.
+
+You can also use docker-compose for one-click deployment, refer to 
[here](./compose/README.md)
+



[GitHub] [apisix-dashboard] juzhiyuan merged pull request #391: doc: Introducing manager-api

2020-08-23 Thread GitBox


juzhiyuan merged pull request #391:
URL: https://github.com/apache/apisix-dashboard/pull/391


   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [apisix] Yiyiyimu commented on a change in pull request #2103: doc: Chinese version of plugins request-id

2020-08-23 Thread GitBox


Yiyiyimu commented on a change in pull request #2103:
URL: https://github.com/apache/apisix/pull/2103#discussion_r475223609



##
File path: doc/zh-cn/plugins/request-id.md
##
@@ -0,0 +1,89 @@
+
+
+[English](../plugins/request-id.md)
+
+# 目录
+
+- [**名称**](#名称)
+- [**属性**](#属性)
+- [**如何启用**](#如何启用)
+- [**测试插件**](#测试插件)
+- [**禁用插件**](#禁用插件)
+- [**示例**](#示例)
+
+
+## 名称
+
+`request-id` 插件通过 APISIX 为每一个请求代理添加唯一 ID(UUID),以用于追踪 API 请求。该插件在 `header_name` 
已经在请求中存在时不会为请求添加新的 ID
+
+## 属性
+
+| 名称| 必选项 | 描述|
+| --- | -- | --- |
+| header_name | 可选   | Request ID header name (默认: X-Request-Id) |
+| include_in_response | 可选   | 是否需要在返回头中包含该唯一ID (默认: true) |
+
+## 如何启用
+
+创建一条路由并在该路由上启用 `request-id` 插件:
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/5 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+"uri": "/get",
+"plugins": {
+"request-id": {
+"include_in_response": true
+}
+},
+"upstream": {
+   "type": "roundrobin",
+   "nodes": {
+   "127.0.0.1:8080": 1
+   }
+}
+}
+```
+
+## 测试插件
+
+```shell
+$ curl -i http://127.0.0.1:9080/hello
+HTTP/1.1 200 OK
+```
+
+## 禁用插件
+
+在路由 `plugins` 配置块中删除 `request-id 配置,即可禁用该插件,无需重启 APISIX。
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/5 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+"uri": "/get",
+"plugins": {
+},
+"upstream": {
+   "type": "roundrobin",
+   "nodes": {
+   "127.0.0.1:8080": 1

Review comment:
   fix in #2108





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [apisix] Yiyiyimu opened a new pull request #2108: doc: fix doc use 4 spaces instead of tab

2020-08-23 Thread GitBox


Yiyiyimu opened a new pull request #2108:
URL: https://github.com/apache/apisix/pull/2108


   ### What this PR does / why we need it:
   fix #2106
   
   ### Pre-submission checklist:
   
   * [x] Did you explain what problem does this PR solve? Or what new features 
have been added?
   * [ ] Have you added corresponding test cases?
   * [x] Have you modified the corresponding document?
   * [x] Is this PR backward compatible?
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [apisix] Yiyiyimu opened a new pull request #2107: doc: add dashboard link in README to sync

2020-08-23 Thread GitBox


Yiyiyimu opened a new pull request #2107:
URL: https://github.com/apache/apisix/pull/2107


   ### Pre-submission checklist:
   
   * [x] Did you explain what problem does this PR solve? Or what new features 
have been added?
   * [ ] Have you added corresponding test cases?
   * [x] Have you modified the corresponding document?
   * [x] Is this PR backward compatible?
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [apisix] Yiyiyimu opened a new issue #2106: bug: some plugin doc use 4 spaces instead of `tab` key

2020-08-23 Thread GitBox


Yiyiyimu opened a new issue #2106:
URL: https://github.com/apache/apisix/issues/2106


   bad indentation, use 4 spaces instead of `tab` key
   
   _Originally posted by @membphis in 
https://github.com/apache/apisix/pull/2103_



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [apisix-dashboard] gxthrj opened a new pull request #391: doc: Introducing manager-api

2020-08-23 Thread GitBox


gxthrj opened a new pull request #391:
URL: https://github.com/apache/apisix-dashboard/pull/391


   Please answer these questions before submitting a pull request
   
   - Why submit this pull request?
   - [ ] Bug fix
   - [x] New feature provided
   - [ ] Improve performance
   
   - Related issues
   
   ___
   ### Bugfix
   - Description
   
   - How to fix?
   
   ___
   ### New feature or improvement
   - Describe the details and related test reports.
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [apisix] Yiyiyimu commented on a change in pull request #2101: feature: customed config.yaml when apisix start

2020-08-23 Thread GitBox


Yiyiyimu commented on a change in pull request #2101:
URL: https://github.com/apache/apisix/pull/2101#discussion_r475217758



##
File path: bin/apisix
##
@@ -940,6 +940,22 @@ function _M.start(...)
 end
 end
 
+local argparse = require "argparse"
+local parser = argparse()
+parser:argument("_", "Placeholder")
+parser:option("-c --config", "location of customed config.yaml")
+local args = parser:parse()
+local customed_yaml = args["config"]
+
+local profile = require("apisix.core.profile")
+profile.apisix_home = apisix_home .. "/"
+local local_conf_path = profile:yaml_path("config")
+
+if customed_yaml then
+local cmd = "cp " .. customed_yaml .. " " .. local_conf_path

Review comment:
   Since the further operation after `apisix start` would still use this 
customized yaml, there is need to save the location somewhere for further 
calling. And let's say save the location to config.yaml, would that be more 
elegant?





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [apisix] Yiyiyimu commented on a change in pull request #2036: feature: support etcd v3, by mocking v2 API

2020-08-23 Thread GitBox


Yiyiyimu commented on a change in pull request #2036:
URL: https://github.com/apache/apisix/pull/2036#discussion_r475215480



##
File path: rockspec/apisix-master-0.rockspec
##
@@ -52,6 +52,7 @@ dependencies = {
 "lua-resty-kafka = 0.07",
 "lua-resty-logger-socket = 2.0-0",
 "skywalking-nginx-lua-plugin = 1.0-0",
+"luaposix = 35.0-1",

Review comment:
   
https://github.com/apache/apisix/blob/bcba1b81dbce62b330873048d4086bd6b91e40b0/bin/apisix#L882





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [apisix] membphis commented on a change in pull request #2101: feature: customed config.yaml when apisix start

2020-08-23 Thread GitBox


membphis commented on a change in pull request #2101:
URL: https://github.com/apache/apisix/pull/2101#discussion_r475213246



##
File path: bin/apisix
##
@@ -940,6 +940,22 @@ function _M.start(...)
 end
 end
 
+local argparse = require "argparse"
+local parser = argparse()
+parser:argument("_", "Placeholder")
+parser:option("-c --config", "location of customed config.yaml")
+local args = parser:parse()
+local customed_yaml = args["config"]
+
+local profile = require("apisix.core.profile")
+profile.apisix_home = apisix_home .. "/"
+local local_conf_path = profile:yaml_path("config")
+
+if customed_yaml then
+local cmd = "cp " .. customed_yaml .. " " .. local_conf_path

Review comment:
   I do not think that is the right way.





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [apisix] membphis commented on a change in pull request #2036: feature: support etcd v3, by mocking v2 API

2020-08-23 Thread GitBox


membphis commented on a change in pull request #2036:
URL: https://github.com/apache/apisix/pull/2036#discussion_r475212996



##
File path: rockspec/apisix-master-0.rockspec
##
@@ -52,6 +52,7 @@ dependencies = {
 "lua-resty-kafka = 0.07",
 "lua-resty-logger-socket = 2.0-0",
 "skywalking-nginx-lua-plugin = 1.0-0",
+"luaposix = 35.0-1",

Review comment:
   where we use this module `luaposix`? please send the code link which 
used this library.





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [apisix] membphis merged pull request #2104: doc: fix broken link of CONTRIBUTING.md in README

2020-08-23 Thread GitBox


membphis merged pull request #2104:
URL: https://github.com/apache/apisix/pull/2104


   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[apisix] branch master updated: doc: fixed broken link of CONTRIBUTING.md in README (#2104)

2020-08-23 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new 2c98dd7  doc: fixed broken link of CONTRIBUTING.md in README (#2104)
2c98dd7 is described below

commit 2c98dd757edb7187034c5da36b2d8559e5c1727b
Author: Shuyang Wu 
AuthorDate: Sun Aug 23 19:17:12 2020 +0800

doc: fixed broken link of CONTRIBUTING.md in README (#2104)
---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 5d9426f..81e4633 100644
--- a/README.md
+++ b/README.md
@@ -293,7 +293,7 @@ CNCF API Gateway Landscape.
 
 ## Contributing
 
-See [CONTRIBUTING](Contributing.md) for details on submitting patches and the 
contribution workflow.
+See [CONTRIBUTING](CONTRIBUTING.md) for details on submitting patches and the 
contribution workflow.
 
 ## Acknowledgments
 



[GitHub] [apisix] membphis opened a new pull request #2105: plugin(fault-injection): use draft7 way to rewrite the JSON Schema.

2020-08-23 Thread GitBox


membphis opened a new pull request #2105:
URL: https://github.com/apache/apisix/pull/2105


   ### What this PR does / why we need it:
   
   
   
   fix #2088
   
   ### Pre-submission checklist:
   
   * [ ] Did you explain what problem does this PR solve? Or what new features 
have been added?
   * [ ] Have you added corresponding test cases?
   * [ ] Have you modified the corresponding document?
   * [ ] Is this PR backward compatible?
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [apisix] swayamraina commented on issue #1574: feature: prometheus plugin `apisix_http_status` metric `route` tag Improve recognition

2020-08-23 Thread GitBox


swayamraina commented on issue #1574:
URL: https://github.com/apache/apisix/issues/1574#issuecomment-678756501


   @membphis is this still open for dev?



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [apisix] Yiyiyimu opened a new pull request #2104: doc: fix broken link of CONTRIBUTING.md in README

2020-08-23 Thread GitBox


Yiyiyimu opened a new pull request #2104:
URL: https://github.com/apache/apisix/pull/2104


   ### What this PR does / why we need it:
   related to #2015
   
   ### Pre-submission checklist:
   
   * [x] Did you explain what problem does this PR solve? Or what new features 
have been added?
   * [ ] Have you added corresponding test cases?
   * [x] Have you modified the corresponding document?
   * [x] Is this PR backward compatible?
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [apisix] Yiyiyimu commented on a change in pull request #2036: feature: support etcd v3, by mocking v2 API

2020-08-23 Thread GitBox


Yiyiyimu commented on a change in pull request #2036:
URL: https://github.com/apache/apisix/pull/2036#discussion_r475199087



##
File path: apisix/core/config_etcd.lua
##
@@ -268,86 +289,90 @@ local function sync_data(self)
 return false, err
 end
 
-local key = short_key(self, res.key)
-if res.value and type(res.value) ~= "table" then
-self:upgrade_version(res.modifiedIndex)
-return false, "invalid item data of [" .. self.key .. "/" .. key
-  .. "], val: " .. tostring(res.value)
-  .. ", it shoud be a object"
-end
-
-if res.value and self.item_schema then
-local ok, err = check_schema(self.item_schema, res.value)
-if not ok then
+local res_copy = res
+for _, res in ipairs(res_copy) do
+local key = short_key(self, res.key)
+if res.value and type(res.value) ~= "table" then
 self:upgrade_version(res.modifiedIndex)
-
-return false, "failed to check item data of ["
-  .. self.key .. "] err:" .. err
+return false, "invalid item data of [" .. self.key .. "/" .. key
+.. "], val: " .. tostring(res.value)

Review comment:
   Thank you! Both fixed





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [apisix] Yiyiyimu commented on a change in pull request #2036: feature: support etcd v3, by mocking v2 API

2020-08-23 Thread GitBox


Yiyiyimu commented on a change in pull request #2036:
URL: https://github.com/apache/apisix/pull/2036#discussion_r475196805



##
File path: rockspec/apisix-master-0.rockspec
##
@@ -52,6 +52,7 @@ dependencies = {
 "lua-resty-kafka = 0.07",
 "lua-resty-logger-socket = 2.0-0",
 "skywalking-nginx-lua-plugin = 1.0-0",
+"luaposix = 35.0-1",

Review comment:
   To set environment variable ETCDCTL_API=3. Is there better way to 
implement this?





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [apisix] Yiyiyimu commented on a change in pull request #2036: feature: support etcd v3, by mocking v2 API

2020-08-23 Thread GitBox


Yiyiyimu commented on a change in pull request #2036:
URL: https://github.com/apache/apisix/pull/2036#discussion_r475196578



##
File path: bin/apisix
##
@@ -870,35 +870,30 @@ local function init_etcd(show_output)
 
 local host_count = #(yaml_conf.etcd.host)
 
--- check whether the user has enabled etcd v2 protocol
-for index, host in ipairs(yaml_conf.etcd.host) do
-uri = host .. "/v2/keys"
-local cmd = "curl -i -m ".. timeout * 2 .. " -o /dev/null -s -w 
%{http_code} " .. uri
-local res = excute_cmd(cmd)
-if res == "404" then
-io.stderr:write(string.format("failed: please make sure that you 
have enabled the v2 protocol of etcd on %s.\n", host))
-return
-end
-end
-
 local etcd_ok = false
 for index, host in ipairs(yaml_conf.etcd.host) do
 
 local is_success = true
-uri = host .. "/v2/keys" .. (etcd_conf.prefix or "")
 
 for _, dir_name in ipairs({"/routes", "/upstreams", "/services",
"/plugins", "/consumers", "/node_status",
"/ssl", "/global_rules", "/stream_routes",
"/proto"}) do
-local cmd = "curl " .. uri .. dir_name
-.. "?prev_exist=false -X PUT -d dir=true "
-.. "--connect-timeout " .. timeout
-.. " --max-time " .. timeout * 2 .. " --retry 1 2>&1"
+local res = require("posix.stdlib").setenv("ETCDCTL_API", 3)
+local key =  (etcd_conf.prefix or "") .. dir_name .. "/"
+-- use suggested v3 ctl `etcdctl` and avoid base64 conversion
+--local base64 = require("base64")
+--uri = host .. "/v3/kv/put"
+--local post_json = '{"value":"' .. base64.encode("null") ..  '", 
"key":"' .. base64.encode(key) .. '"}'
+--cmd = "curl " .. uri

Review comment:
   fixed

##
File path: bin/apisix
##
@@ -870,35 +870,30 @@ local function init_etcd(show_output)
 
 local host_count = #(yaml_conf.etcd.host)
 
--- check whether the user has enabled etcd v2 protocol
-for index, host in ipairs(yaml_conf.etcd.host) do
-uri = host .. "/v2/keys"
-local cmd = "curl -i -m ".. timeout * 2 .. " -o /dev/null -s -w 
%{http_code} " .. uri
-local res = excute_cmd(cmd)
-if res == "404" then
-io.stderr:write(string.format("failed: please make sure that you 
have enabled the v2 protocol of etcd on %s.\n", host))
-return
-end
-end
-
 local etcd_ok = false
 for index, host in ipairs(yaml_conf.etcd.host) do
 
 local is_success = true
-uri = host .. "/v2/keys" .. (etcd_conf.prefix or "")
 
 for _, dir_name in ipairs({"/routes", "/upstreams", "/services",
"/plugins", "/consumers", "/node_status",
"/ssl", "/global_rules", "/stream_routes",
"/proto"}) do
-local cmd = "curl " .. uri .. dir_name
-.. "?prev_exist=false -X PUT -d dir=true "
-.. "--connect-timeout " .. timeout
-.. " --max-time " .. timeout * 2 .. " --retry 1 2>&1"
+local res = require("posix.stdlib").setenv("ETCDCTL_API", 3)
+local key =  (etcd_conf.prefix or "") .. dir_name .. "/"
+-- use suggested v3 ctl `etcdctl` and avoid base64 conversion
+--local base64 = require("base64")
+--uri = host .. "/v3/kv/put"
+--local post_json = '{"value":"' .. base64.encode("null") ..  '", 
"key":"' .. base64.encode(key) .. '"}'
+--cmd = "curl " .. uri
+--.. " -X POST -d '" .. post_json
+--.. "' --connect-timeout " .. timeout
+--.. " --max-time " .. timeout * 2 .. " --retry 1 2>&1"
+local cmd = "etcdctl --endpoints=" .. host .. " put " .. key .. " 
init_dir"
 
 local res = excute_cmd(cmd)
-if not res:find("index", 1, true)
-and not res:find("createdIndex", 1, true) then
+if (etcd_version == "v3" and not res:find("OK", 1, true)) then
+--  (etcd_version == "v3" and not res:find("revision", 1, 
true)) then

Review comment:
   fixed





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [apisix] Yiyiyimu commented on a change in pull request #2036: feature: support etcd v3, by mocking v2 API

2020-08-23 Thread GitBox


Yiyiyimu commented on a change in pull request #2036:
URL: https://github.com/apache/apisix/pull/2036#discussion_r475196637



##
File path: bin/apisix
##
@@ -870,35 +870,30 @@ local function init_etcd(show_output)
 
 local host_count = #(yaml_conf.etcd.host)
 
--- check whether the user has enabled etcd v2 protocol
-for index, host in ipairs(yaml_conf.etcd.host) do
-uri = host .. "/v2/keys"
-local cmd = "curl -i -m ".. timeout * 2 .. " -o /dev/null -s -w 
%{http_code} " .. uri
-local res = excute_cmd(cmd)
-if res == "404" then
-io.stderr:write(string.format("failed: please make sure that you 
have enabled the v2 protocol of etcd on %s.\n", host))
-return
-end
-end
-
 local etcd_ok = false
 for index, host in ipairs(yaml_conf.etcd.host) do
 
 local is_success = true
-uri = host .. "/v2/keys" .. (etcd_conf.prefix or "")
 
 for _, dir_name in ipairs({"/routes", "/upstreams", "/services",
"/plugins", "/consumers", "/node_status",
"/ssl", "/global_rules", "/stream_routes",
"/proto"}) do
-local cmd = "curl " .. uri .. dir_name
-.. "?prev_exist=false -X PUT -d dir=true "
-.. "--connect-timeout " .. timeout
-.. " --max-time " .. timeout * 2 .. " --retry 1 2>&1"
+local res = require("posix.stdlib").setenv("ETCDCTL_API", 3)
+local key =  (etcd_conf.prefix or "") .. dir_name .. "/"
+-- use suggested v3 ctl `etcdctl` and avoid base64 conversion
+--local base64 = require("base64")
+--uri = host .. "/v3/kv/put"
+--local post_json = '{"value":"' .. base64.encode("null") ..  '", 
"key":"' .. base64.encode(key) .. '"}'
+--cmd = "curl " .. uri
+--.. " -X POST -d '" .. post_json
+--.. "' --connect-timeout " .. timeout
+--.. " --max-time " .. timeout * 2 .. " --retry 1 2>&1"
+local cmd = "etcdctl --endpoints=" .. host .. " put " .. key .. " 
init_dir"

Review comment:
   fixed





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [apisix] membphis commented on a change in pull request #2036: feature: support etcd v3, by mocking v2 API

2020-08-23 Thread GitBox


membphis commented on a change in pull request #2036:
URL: https://github.com/apache/apisix/pull/2036#discussion_r475192884



##
File path: apisix/core/config_etcd.lua
##
@@ -268,86 +289,90 @@ local function sync_data(self)
 return false, err
 end
 
-local key = short_key(self, res.key)
-if res.value and type(res.value) ~= "table" then
-self:upgrade_version(res.modifiedIndex)
-return false, "invalid item data of [" .. self.key .. "/" .. key
-  .. "], val: " .. tostring(res.value)
-  .. ", it shoud be a object"
-end
-
-if res.value and self.item_schema then
-local ok, err = check_schema(self.item_schema, res.value)
-if not ok then
+local res_copy = res
+for _, res in ipairs(res_copy) do
+local key = short_key(self, res.key)
+if res.value and type(res.value) ~= "table" then
 self:upgrade_version(res.modifiedIndex)
-
-return false, "failed to check item data of ["
-  .. self.key .. "] err:" .. err
+return false, "invalid item data of [" .. self.key .. "/" .. key
+.. "], val: " .. tostring(res.value)

Review comment:
   bad indentation

##
File path: rockspec/apisix-master-0.rockspec
##
@@ -52,6 +52,7 @@ dependencies = {
 "lua-resty-kafka = 0.07",
 "lua-resty-logger-socket = 2.0-0",
 "skywalking-nginx-lua-plugin = 1.0-0",
+"luaposix = 35.0-1",

Review comment:
   why we need this Lua module?

##
File path: bin/apisix
##
@@ -870,35 +870,30 @@ local function init_etcd(show_output)
 
 local host_count = #(yaml_conf.etcd.host)
 
--- check whether the user has enabled etcd v2 protocol
-for index, host in ipairs(yaml_conf.etcd.host) do
-uri = host .. "/v2/keys"
-local cmd = "curl -i -m ".. timeout * 2 .. " -o /dev/null -s -w 
%{http_code} " .. uri
-local res = excute_cmd(cmd)
-if res == "404" then
-io.stderr:write(string.format("failed: please make sure that you 
have enabled the v2 protocol of etcd on %s.\n", host))
-return
-end
-end
-
 local etcd_ok = false
 for index, host in ipairs(yaml_conf.etcd.host) do
 
 local is_success = true
-uri = host .. "/v2/keys" .. (etcd_conf.prefix or "")
 
 for _, dir_name in ipairs({"/routes", "/upstreams", "/services",
"/plugins", "/consumers", "/node_status",
"/ssl", "/global_rules", "/stream_routes",
"/proto"}) do
-local cmd = "curl " .. uri .. dir_name
-.. "?prev_exist=false -X PUT -d dir=true "
-.. "--connect-timeout " .. timeout
-.. " --max-time " .. timeout * 2 .. " --retry 1 2>&1"
+local res = require("posix.stdlib").setenv("ETCDCTL_API", 3)
+local key =  (etcd_conf.prefix or "") .. dir_name .. "/"
+-- use suggested v3 ctl `etcdctl` and avoid base64 conversion
+--local base64 = require("base64")
+--uri = host .. "/v3/kv/put"
+--local post_json = '{"value":"' .. base64.encode("null") ..  '", 
"key":"' .. base64.encode(key) .. '"}'
+--cmd = "curl " .. uri

Review comment:
   only one way is easier for user. `etcdctl` is enough.

##
File path: apisix/core/config_etcd.lua
##
@@ -268,86 +289,90 @@ local function sync_data(self)
 return false, err
 end
 
-local key = short_key(self, res.key)
-if res.value and type(res.value) ~= "table" then
-self:upgrade_version(res.modifiedIndex)
-return false, "invalid item data of [" .. self.key .. "/" .. key
-  .. "], val: " .. tostring(res.value)
-  .. ", it shoud be a object"
-end
-
-if res.value and self.item_schema then
-local ok, err = check_schema(self.item_schema, res.value)
-if not ok then
+local res_copy = res
+for _, res in ipairs(res_copy) do
+local key = short_key(self, res.key)
+if res.value and type(res.value) ~= "table" then
 self:upgrade_version(res.modifiedIndex)
-
-return false, "failed to check item data of ["
-  .. self.key .. "] err:" .. err
+return false, "invalid item data of [" .. self.key .. "/" .. key
+.. "], val: " .. tostring(res.value)

Review comment:
   if the `res.value` is a talbe, we need to encode it with `json`
   
   if the `res.value` is non-table, we do not need to call `tostring`





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about 

[GitHub] [apisix] membphis commented on pull request #2036: feature: support etcd v3, by mocking v2 API

2020-08-23 Thread GitBox


membphis commented on pull request #2036:
URL: https://github.com/apache/apisix/pull/2036#issuecomment-678748139


   > I think we should create a new branch that using etcd v2 before the 
merge,and maintain it for a while,for the users who can’t migrate to etcd v
   
   I have created a new branch named `etcd-v2` right now.



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[apisix] branch etcd-v2 created (now 6ffd8b9)

2020-08-23 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a change to branch etcd-v2
in repository https://gitbox.apache.org/repos/asf/apisix.git.


  at 6ffd8b9  doc: Chinese version of plugins request-id (#2103)

No new revisions were added by this update.



[GitHub] [apisix] membphis commented on issue #2034: feature: allow user to specify the `conf/config.yaml` when starting the APISIX project.

2020-08-23 Thread GitBox


membphis commented on issue #2034:
URL: https://github.com/apache/apisix/issues/2034#issuecomment-678747733


   @Yiyiyimu In this way, users can more easily start APISIX with a custom 
"config.yaml" file, which is useful.
   
   Many software supports this way of starting, such as: nginx and envoy.



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [apisix-dashboard] bzp2010 merged pull request #390: fix(ci): fix read configuration file path in docker

2020-08-23 Thread GitBox


bzp2010 merged pull request #390:
URL: https://github.com/apache/apisix-dashboard/pull/390


   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[apisix-dashboard] branch master updated: fix(ci): fix read configuration file path in docker (#390)

2020-08-23 Thread bzp2010
This is an automated email from the ASF dual-hosted git repository.

bzp2010 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git


The following commit(s) were added to refs/heads/master by this push:
 new 619a4c9  fix(ci): fix read configuration file path in docker (#390)
619a4c9 is described below

commit 619a4c903180c4218bd4917c58893eb5b98e9122
Author: bzp2010 
AuthorDate: Sun Aug 23 16:14:19 2020 +0800

fix(ci): fix read configuration file path in docker (#390)
---
 api/Dockerfile |  2 +-
 api/build.sh   | 27 ++-
 2 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/api/Dockerfile b/api/Dockerfile
index 264672a..bba8f0a 100644
--- a/api/Dockerfile
+++ b/api/Dockerfile
@@ -24,7 +24,7 @@ RUN mkdir /root/manager-api \
 && export GOPROXY=https://goproxy.io \
 && go build -o /root/manager-api/manager-api \
 && mv /go/src/github.com/apisix/manager-api/build.sh /root/manager-api/ \
-&& mv /go/src/github.com/apisix/manager-api/conf/conf_preview.json 
/root/manager-api/ \
+&& mv /go/src/github.com/apisix/manager-api/conf/conf_preview.json 
/root/manager-api/conf.json \
 && rm -rf /go/src/github.com/apisix/manager-api \
 && rm -rf /etc/localtime \
 && ln -s  /usr/share/zoneinfo/Hongkong /etc/localtime \
diff --git a/api/build.sh b/api/build.sh
index 086fe73..09e6e01 100644
--- a/api/build.sh
+++ b/api/build.sh
@@ -1,21 +1,22 @@
 #!/bin/sh
 #  
 # Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.  
-# The ASF licenses this file to You under the Apache License, Version 2.0  
-# (the "License"); you may not use this file except in compliance with 
-# the License.  You may obtain a copy of the License at
-#  
-# http://www.apache.org/licenses/LICENSE-2.0   
-#  
-# Unless required by applicable law or agreed to in writing, software  
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
-# See the License for the specific language governing permissions and  
-# limitations under the License.   
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
 #
 
+export ENV=prod
 pwd=`pwd`
 
 sed -i -e "s%#mysqlAddress#%`echo $MYSQL_SERVER_ADDRESS`%g" ${pwd}/conf.json



[GitHub] [apisix-dashboard] bzp2010 opened a new pull request #390: fix(ci): fix read configuration file path in docker

2020-08-23 Thread GitBox


bzp2010 opened a new pull request #390:
URL: https://github.com/apache/apisix-dashboard/pull/390


   Please answer these questions before submitting a pull request
   
   - Why submit this pull request?
   - [x] Bug fix
   - [ ] New feature provided
   - [ ] Improve performance
   
   - Related issues
   
   ___
   ### Bugfix
   - Description
   Because of the wrong environment variable, the Manager API cannot set the 
correct configuration file path when running in docker.
   - How to fix?
   Add an export in `build.sh` script.
   Change moved file name in Dockerfile.
   ___
   ### New feature or improvement
   - Describe the details and related test reports.
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org