From bffbf5612373bcb5f66aa53e11497d5765f57229 Mon Sep 17 00:00:00 2001 From: dongjunduo Date: Tue, 4 Apr 2023 01:53:18 -0700 Subject: [PATCH] correct warning --- apisix/admin/init.lua | 2 +- apisix/cli/ops.lua | 2 +- t/admin/api.t | 13 ++++++++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/apisix/admin/init.lua b/apisix/admin/init.lua index 8615f13ac021..ccea011fe23d 100644 --- a/apisix/admin/init.lua +++ b/apisix/admin/init.lua @@ -405,7 +405,7 @@ function _M.init_worker() if local_conf.deployment.admin.admin_key_required == false then core.log.warn("Admin key is bypassed! ", "If you are deploying APISIX in a production environment, ", - "please disable it and set a secure password for the admin Key!") + "please disable `admin_key_required` and set a secure admin key!") end local ok, err = ngx_timer_at(0, function(premature) diff --git a/apisix/cli/ops.lua b/apisix/cli/ops.lua index cb5c715e2949..ebd3061e0c12 100644 --- a/apisix/cli/ops.lua +++ b/apisix/cli/ops.lua @@ -194,7 +194,7 @@ local function init(env) checked_admin_key = true print("Warning! Admin key is bypassed! " .. "If you are deploying APISIX in a production environment, " - .. "please disable it and set a secure password for the admin Key!") + .. "please disable `admin_key_required` and set a secure admin key!") end if yaml_conf.apisix.enable_admin and not checked_admin_key then diff --git a/t/admin/api.t b/t/admin/api.t index 204878b29b3e..c3b5620c3f66 100644 --- a/t/admin/api.t +++ b/t/admin/api.t @@ -183,7 +183,18 @@ GET /apisix/admin/routes -=== TEST 12: Access without api key, but admin_key_required=false +=== TEST 12: Access without api key, but admin_key_required=true +--- yaml_config +deployment: + admin: + admin_key_required: true +--- request +GET /apisix/admin/routes +--- error_code: 200 + + + +=== TEST 13: Access without api key, but admin_key_required=false --- yaml_config deployment: admin: