tufanbarisyildirim / gonginx

Nginx configuration parser helps you to parse, edit, regenerate your nginx config in your go applications
https://github.com/tufanbarisyildirim/gonginx
MIT License
176 stars 48 forks source link
devops devops-tools golang lexer nginx parser

Report Card Actions Status

Gonginx

TBH, I would like to rewrite the parser next time I need it again :)) but it still does its job.

Gonginx is an Nginx configuration parser helps you to parse, edit, regenerate your nginx config files in your go applications. It makes managing your balancer configurations easier.

Basic grammar of an nginx config file


%token Keyword Variable BlockStart BlockEnd Semicolon Regex

%%

config      :  /* empty */ 
            | config directives
            ;
block       : BlockStart directives BlockEnd
            ;
directives  : directives directive
            ;
directive   : Keyword [parameters] (semicolon|block)
            ;
parameters  : parameters keyword
            ;
keyword     : Keyword 
            | Variable 
            | Regex
            ;

API

Core Components

Examples

Examples and Library Reference

TODO

Limitations

There is no known limitations yet. PRs are more than welcome if you want to implement a specific directive / block, please read Contributing before your first PR.

License

MIT License