nginx-config-formatter
nginx-config-formatter copied to clipboard
nginx config file formatter/beautifier written in Python with no additional dependencies.
nginxbeautifier.com seems to be offline. would be great if there was an online version of this for easy use without installing local packages.
No need special treatment for variable ${} , because any expression with "{" should be enclosed in single or double quotes. So, we just need to substitute `{` and `}`...
This (it comes from sample nginx magento snippet) ``` gzip_types text/plain text/css text/js text/xml text/javascript application/javascript application/x-javascript application/json application/xml application/xml+rss image/svg+xml; ``` is converted to ``` gzip_types text/plain text/css text/js...
May be add 4 space after proxy_set_header for improve readability? Before ``` proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Real-IP $remote_addr;...
`add_header alt-svc 'h3=":443"; ma=86400, h3-29=":443"; ma=86400' always;` will be break into 3 lines and like this: add_header alt-svc 'h3=":443"; ma=86400, h3-29=":443"; ma=86400' always; Though it passes the nginx conf test...
It would be cool if while formatting it could use [editorconfig](https://editorconfig.org/) settings.