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



##########
File path: bin/apisix
##########
@@ -643,6 +643,34 @@ local function read_yaml_conf()
         merge_conf(default_conf, user_conf)
     end
 
+    -- check the Admin API token
+    if default_conf.apisix.enable_admin then
+        local help = [[
+ERROR: missing valid apisix.admin_key
+
+You can call `]] .. arg[0] .. [[ gen_admin_key` to generate a new Admin API 
key or
+manually update the `conf/config.yaml` file.
+]]
+        if type(default_conf.apisix.admin_key) ~= "table" or
+           #default_conf.apisix.admin_key == 0
+        then
+            io.stderr:write(help, "\n")
+            os.exit(1)
+        end
+
+        for _, admin in ipairs(default_conf.apisix.admin_key) do
+            if type(admin.key) == "table" then
+                admin.key = ""
+            else
+                admin.key = tostring(admin.key)
+            end
+
+            if admin.key == "" or admin.key:gsub("*", "") == "" then

Review comment:
       In APISIX, the Admin API Key containing only `*` is invalid.
   It is shadowy, but it works.
   
   If we use `YOUR_OWN_API_TOKEN` as Key, then we have to disable it here too.




----------------------------------------------------------------
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


Reply via email to