clessli
clessli
The `nginx.Parser` does not support fields or contexts in the format of `Lua Scripts` currently. You can consider first to separate `Lua Scripts` into script files and set a `parser.Key`...
> 有相关使用手册吗? 暂时还没时间做全面的文档编写 可以先看下首页README提供的[使用方法](https://github.com/ClessLi/bifrost#%E4%BD%BF%E7%94%A8%E6%96%B9%E6%B3%95)及相关接口定义 ### nginx配置解析相关可以查看相关接口定义: nginx配置对象接口定义([Configuration](https://github.com/ClessLi/bifrost/blob/master/pkg/resolv/V2/nginx/configuration/configuration.go)) ```golang // keyword string: [':sep: ', ':sep: :reg: '] // // e.g. for Nginx Config keyword string: // 1) server // 2) location:sep:...
> > ```go > > LoadFromJsonBytes > > ``` > > > //type Updater interface { // UpdateFromJsonBytes(data []byte) error //} > > // keyword string: [':sep: ', ':sep: :reg:...
> > > > ```go > > > > LoadFromJsonBytes > > > > ``` > > > > > > > > > > > > //type Updater interface...
> > ```go > > httpCTX > > ``` > > manager configuration.ConfigManager manager.GetConfiguration().InsertByKeyword(parser.NewKey("http", "keyword", parser_indention.NewIndention()), "server") 我自己测了下代码,这里是表示在跟server同级的地方插入http keyword么,这里indention没生效,然后还有个InsertByQuerier也是,就这两个没看懂 我重新写了一个示例,可供参考: ```go import ( "fmt" "github.com/ClessLi/bifrost/pkg/resolv/V2/nginx/configuration" "github.com/ClessLi/bifrost/pkg/resolv/V2/nginx/configuration/parser" "github.com/ClessLi/bifrost/pkg/resolv/V2/nginx/parser_type" "testing" ) func...
> > ```go > > configuration > > ``` > > > ```go > > err = c.InsertByKeyword(srv2CTX, "server") > > if err != nil { > > t.Fatal(err) >...
> 成功了,但还是最后一个问题,configuration.NewConfigurationFromJsonBytes()只能接收configuration.json转化的json,如果从远程读取nginx配置文件,有办法不把nginx.conf存储在本地的情况下从远程读取然后把二进制流直接放进去么 通过bifrost客户端获取的json数据加载后,是存在内存里的数据,不用ConfigManager自动保存操作,是不会将服务端nginx配置数据保存在客户端本地的。在客户端本地对服务端nginx配置对象按需修改后,可以序列化为json数据后,调用bifrost客户端更新回服务端。具体代码我明日再付上,这期间你也可以再研究研究
> 成功了,但还是最后一个问题,configuration.NewConfigurationFromJsonBytes()只能接收configuration.json转化的json,如果从远程读取nginx配置文件,有办法不把nginx.conf存储在本地的情况下从远程读取然后把二进制流直接放进去么 可以看看这个测试用例里的调用,[client_test.go](https://github.com/ClessLi/bifrost/blob/02b8af763fc73d4cc7fb475c3b9c887cc7372aa9/test/grpc_client/bifrost/client_test.go#L104-L112)。 获取到`conf`对象后,可以对`conf`按需操作,最后提交配置更新,参考如下 ```go ... conf, err := configuration.NewConfigurationFromJsonBytes(jsondata) ... err := client.WebServerConfig().Update(servername, conf.Json()) // 提交更新配置 ```
> _No description provided._ 暂时未收到bug反馈,我们内部使用也还暂未发现恶性bug