const configString = ` http { proxy_cache_path /var/cache/nginx/users keys_zone=users:1m levels=2 use_temp_path=off inactive=1d max_size=16m; } `; const json = parser.toJSON(configString); const expectedOutput =
toJSON(configString); const expectedOutput = ` http { proxy_cache_path /var/cache/nginx/users keys_zone=users:1m levels=2 use_temp_path=off inactive=1d max_size=16m; } `; parser.toConf(json) === expectedOutput; // trueAbout Parse nginx config strings into js objects and back ...
console.log(JSON.stringify(config)) 说明 目前关于nginx 解析方便的工具并不是很多(主要是nginx 配置并不是很复杂,我们基于模版引擎也可以解决) @webantic/nginx-config-parser 是一个不错的选择,可以解决我们管理nginx 配置的一些问题,而且支持json 以及nginx 配置的模式 集成到我们的系统中是一个不错的选择...
publicclassMain{publicstaticvoidmain(String[]args){NginxConfigParserparser=newNginxConfigParser();parser.deleteParam("nginx.conf","server_name");}} 1. 2. 3. 4. 5. 6. 7. 在上面的示例代码中,我们创建了一个Main类,实例化了NginxConfigParser对象,并调用了deleteParam方法来删除server_name参数。 状...
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. ...
This is a config parser most similar to Nginx, supports Json format, but with line-breaks, comments, etc. Also, like Nginx is more lenient. Uses same syntax ashttps://github.com/vstakhov/libucl UseSublimeText Nginx Pluginfor formatting. ...
Nginx configuration style parser with golang Install go get github.com/recoye/config Document Create a new file(example.conf) #daemon yes; daemon no; log_file run/log/file.log; server { host 127.0.0.1; port 80; } Define configuration's struct ...
The package ngconf supplies a generic parser of the NGINX config format referring to the implementation python-nginx, and supports Go 1.x.Examplepackage main import ( "fmt" "github.com/xgfone/ngconf" ) const conf = ` user www-data; worker_processes auto; pid /run/nginx.pid; include /...
Config file parser for Go in the style of nginx. Contribute to nilium/codf development by creating an account on GitHub.