You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by me...@apache.org on 2019/11/09 13:07:34 UTC

[incubator-apisix] branch master updated: fix: show more firendly error log when configuration field missed (#824)

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


The following commit(s) were added to refs/heads/master by this push:
     new 7b29586  fix: show more firendly error log when configuration field missed (#824)
7b29586 is described below

commit 7b29586f7ada4c3b52eb0aebfad85f05fac03b23
Author: Lien <li...@users.noreply.github.com>
AuthorDate: Sat Nov 9 21:07:24 2019 +0800

    fix: show more firendly error log when configuration field missed (#824)
---
 bin/apisix | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/bin/apisix b/bin/apisix
index 3a097d0..6cdaaf0 100755
--- a/bin/apisix
+++ b/bin/apisix
@@ -507,6 +507,15 @@ local function init()
         node_ssl_listen = 9443,     -- default value
         error_log = {level = "warn"},
     }
+
+    if not yaml_conf.apisix then
+        error("failed to read `apisix` field from yaml file")
+    end
+
+    if not yaml_conf.nginx_config then
+        error("failed to read `nginx_config` field from yaml file")
+    end
+
     for k,v in pairs(yaml_conf.apisix) do
         sys_conf[k] = v
     end
@@ -543,10 +552,18 @@ local function init_etcd(show_output)
         error("failed to read local yaml config of apisix: " .. err)
     end
 
+    if not yaml_conf.apisix then
+        error("failed to read `apisix` field from yaml file when init etcd")
+    end
+
     if yaml_conf.apisix.config_center ~= "etcd" then
         return true
     end
 
+    if not yaml_conf.etcd then
+        error("failed to read `etcd` field from yaml file when init etcd")
+    end
+
     local etcd_conf = yaml_conf.etcd
     local uri = etcd_conf.host .. "/v2/keys" .. (etcd_conf.prefix or "")