odiszapc / nginx-java-parser

Nginx configuration parser based on ANTLR4 grammar
260 stars 87 forks source link

Awesome project. How to create a new entry? #9

Closed MTyson closed 8 years ago

MTyson commented 8 years ago

Awesome project!

Sorry if this is obvious, but what is the syntax to create a new entry in a conf file?

For instance, if I want to add the following proxy config to a file that doesn't have any proxy config yet:

location /api {
      proxy_pass      http://foo.bar/bazi;
          proxy_redirect off;
      proxy_buffering off;
    }
MTyson commented 8 years ago

I hope this project is alive, I've been using it today and the design and API is very clean and easy to figure out.

MTyson commented 8 years ago

Config can be modified like so:

NgxBlock newLocation = new NgxBlock(); newLocation.addValue("location"); newLocation.addValue("/"+envApp.getName());