Detecting kong admin from inside plugins

We are running Kong Admin and Kong Proxy in two different clusters and would like to detect whether we are running in Admin or Proxy container from plugins and serverless functions.

Currently, I am exposing ADMIN_LISTEN environment variable to nginx workers and using that to detect whether the container is admin or not.

functions: ["if (os.getenv('KONG_ADMIN_LISTEN') ~= '127.0.0.1:8001' ) then return kong.response.exit(401) end" ]

Does anyone know a better way to accomplish this?

Thanks.


© 2019 Kong Inc.    Terms  •  Privacy  •  FAQ