Convert nginx conf strings to JSON and back!. Latest version: 1.6.1, last published: 2 years ago. Start using @webantic/nginx-config-parser in your project by running `npm i @webantic/nginx-config-parser`. There are 15 other projects in the npm registry
writeConfigFile('/path/to/newfile.conf', config, true) var sampleConfig = { "server": { "server_name": "_", "location /": { "try_files": "*.html" } } } // to multi-line config string var configString = parser.toConf(sampleConfig) // and back again var configJson = ...
varconfigWithoutIncludes=parser.readConfigFile('demo.conf', {parseIncludes:false }) // write direct to file (overwriting existing one) // 读取写到其他地方,比如基于json的解析,然后写到一个s3 的挂载中 parser.writeConfigFile('mynginx.conf',config,true) console.log(configWithoutIncludes.server) //...
假设我们有一个名为nginx.conf的配置文件,我们想要删除server_name参数。 publicclassMain{publicstaticvoidmain(String[]args){NginxConfigParserparser=newNginxConfigParser();parser.deleteParam("nginx.conf","server_name");}} 1. 2. 3. 4. 5. 6. 7. 在上面的示例代码中,我们创建了一个Main类,实例化了N...
Nginx configuration Java parser This library helps in analyzing Nginx web server configuration files, looking up for specified parameters, blocks, regular expressions or comments. Then AST can be modified and converted back to plain file. 在原基础上增加了query系列函数、快速方便定位指定节点。
import com.github.odiszapc.nginxparser.NgxParam; import java.io.IOException; import java.util.List; /** * @since 0.13.0 */ public class NginxUserConfigLoaderConfigFile extends AbstractNginxUserConfigLoader { private final String filePath; ...
ParserHow to perform basic parsing of the following Nginx config:NgxConfig conf = NgxConfig.read("/etc/nginx/nginx.conf"); NgxParam workers = conf.findParam("worker_processes"); // Ex.1 workers.getValue(); // "1" NgxParam listen = conf.findParam("http", "server", "listen"); // ...
Parser How to perform basic parsing of the following Nginx config: NgxConfig conf = NgxConfig.read("/etc/nginx/nginx.conf"); NgxParam workers = conf.findParam("worker_processes"); // Ex.1 workers.getValue(); // "1" NgxParam listen = conf.findParam("http", "server", "listen"); /...
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库:https://github.com/odiszapc/nginx-java-parser 该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。 master 克隆/下载 git config --global user.name userName git config --global user.email userEmail ...
在github上找到nginx-java-parser工具,项目地址:https://github.com/odiszapc/nginx-java-parser 解析nginx.conf过程可以参考该项目的README.md 下面举个列子说明一下该如何编辑nginx.conf。 定义一个pojo importcom.alibaba.fastjson.JSONArray;importcom.google.common.base.Strings;importlombok.Data; ...