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/incubator-apisix.git


The following commit(s) were added to refs/heads/master by this push:
     new 2a2762a  CLI: Adding warning message when running APISIX in root path. 
(#1236)
2a2762a is described below

commit 2a2762a9c269f86c265d76cd2de07db1881aa55d
Author: Nirojan Selvanathan <[email protected]>
AuthorDate: Fri Mar 13 08:57:12 2020 +0100

    CLI: Adding warning message when running APISIX in root path. (#1236)
---
 bin/apisix | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/bin/apisix b/bin/apisix
index 3337eca..1c4f266 100755
--- a/bin/apisix
+++ b/bin/apisix
@@ -41,6 +41,7 @@ local pkg_path  = apisix_home .. 
"/deps/share/lua/5.1/apisix/lua/?.lua;"
                   .. apisix_home .. "/deps/share/lua/5.1/?.lua;;"
 
 -- only for developer, use current folder as working space
+local is_root_path = false
 local script_path = arg[0]
 if script_path:sub(1, 2) == './' then
     apisix_home = trim(excute_cmd("pwd"))
@@ -48,6 +49,10 @@ if script_path:sub(1, 2) == './' then
         error("failed to fetch current path")
     end
 
+    if string.match(apisix_home, '^/[root][^/]+') then
+            is_root_path = true
+    end
+
     pkg_cpath = apisix_home .. "/deps/lib64/lua/5.1/?.so;"
                 .. apisix_home .. "/deps/lib/lua/5.1/?.so;"
     pkg_path  = apisix_home .. "/lua/?.lua;"
@@ -549,6 +554,11 @@ version:    print the version of apisix
 end
 
 local function init()
+    if is_root_path then
+        print('Warning! Running apisix under /root is only suitable for 
development environments'
+            .. ' and it is dangerous to do so. It is recommended to run APISIX 
in a directory other than /root.')
+    end
+
     -- read_yaml_conf
     local yaml_conf, err = read_yaml_conf()
     if not yaml_conf then

Reply via email to