nginx-lint-parser 0.12.2

nginx configuration file parser
Documentation
# OpenResty / lua-nginx-module configuration
worker_processes auto;

events {
    worker_connections 1024;
}

http {
    lua_package_path '/usr/local/openresty/lualib/?.lua;;';
    lua_package_cpath '/usr/local/openresty/lualib/?.so;;';
    lua_shared_dict my_cache 10m;
    lua_code_cache on;

    init_by_lua_block {
        require "resty.core"
        cjson = require "cjson"
    }

    server {
        listen 80;
        server_name lua.example.com;

        location /api {
            content_by_lua_block {
                local cjson = require "cjson"
                ngx.header["Content-Type"] = "application/json"
                ngx.say(cjson.encode({status = "ok", time = ngx.now()}))
            }
        }

        location /auth {
            access_by_lua_block {
                local token = ngx.var.http_authorization
                if not token then
                    ngx.exit(ngx.HTTP_UNAUTHORIZED)
                end
            }
            proxy_pass http://127.0.0.1:8080;
        }

        location /log {
            log_by_lua_block {
                local latency = tonumber(ngx.var.request_time)
                if latency > 1.0 then
                    ngx.log(ngx.WARN, "slow request: ", latency, "s")
                end
            }
            proxy_pass http://127.0.0.1:8080;
        }
    }
}