-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gonginx does not seem to catch syntax errors in nginx.conf
#31
Comments
@tufanbarisyildirim any ideas? |
Hello @kehoecj , sorry I have missed this, this looks like an interesting bug, thanks for raising it. I will be back here around weekend. |
Honestly, I didn't expect it to be utilized so extensively, and I absolutely enjoy the BUGS that can offer opportunities to reshape the core logic. DEAL |
Hello @kehoecj can you please try to see if that version helps you? https://github.com/tufanbarisyildirim/gonginx/tree/v2 That was a simple workaround, I will release a version for you that you can stick with and then jump in refactoring it. |
Hi @tufanbarisyildirim, But when I feed the config with some nonsense keyword like "listena" in this example:
The gonginx says it's valid. But it's not. Testing with nginx -t -c nginx-bad-2.conf gives me expected:
Is it something what can be fixed, too ? Thanks ! |
oh hmm, that's an easy one I will add directive validation as well but it actually does not suppose to validate logically because nginx -t can also check the files, permissions etc, but still a good star to add directive validation, will add it. |
give it a test! |
That's perfect, it works ! May I ask you to release a version for us ? Thanks a lot ! |
* handle errors go way, init fixing #31 * add option to skip comments * handle unexpected eof in block parsing * fix building issues for examples * validate known directives * delete duplicate directives, fix tests, make linter happy
sure: https://github.com/tufanbarisyildirim/gonginx/releases/tag/2.0.0 |
I think we can close this issue, it's good enough at least for now ;-) Once again thanks a lot for your help, @tufanbarisyildirim ! |
You are welcome, happy to help. will keep this version as base of v2.x.x, thanks for pointing out issues. |
We were hoping to use gonginx in the config-file-validator tool to provide syntax validation for
nginx.conf
files. During some testing we noticed that gonginx will not throw an error if the syntax of thenginx.conf
file is invalid. For example, in this test we intentionally did not close a server block and it parsed without error.Is this expected behavior, a bug, or are we parsing incorrectly?
The text was updated successfully, but these errors were encountered: