vasilevich / nginxbeautifier

Format and beautify nginx config files
https://nginxbeautifier.com
Apache License 2.0
164 stars 20 forks source link

end of line comment breaks #9

Closed lukasa1993 closed 5 years ago

lukasa1993 commented 5 years ago
server {
    if ($host = example.com) {
        return 301 https://$host$request_uri;
    } # testing comment line

        server_name example.com;
    listen 80;
    return 404; # testing comment line

}

this is transformed into

server
{
    if ($host = example.com)
    {
        return 301 https://$host$request_uri;
        } # testing comment lin
    }
    # testing comment line

    server_name example.com;
    listen 80;
    return 404; # testing comment line

}
lukasa1993 commented 5 years ago

same happens with https://github.com/denysvitali/nginxbeautify this as well

vasilevich commented 5 years ago

hello @lukasa1993 I am sorry I don't understand the issue,

can you please post the results you wish to recieve aswell? or mark in paint or something what exactly is wrong.

thanks!

lukasa1993 commented 5 years ago

there is early } which breaks syntax is closes server scope after if

vasilevich commented 5 years ago

I see now, I will see what I can do about this thank you for reporting.

vasilevich commented 5 years ago

@lukasa1993 Hello! I fixed the issue mentioned, I did not yet update nginxbeautifier.com but I pushed the npm module with up to date fix.

please reopen this issue if its not resolved, or open a new issue if you need anything else.