Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize the parameters for settings. #837

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

TanShun
Copy link

@TanShun TanShun commented Nov 24, 2020

把插件的私有XML配置改为ES插件支持的标准YAML格式,并把插件私有的配置参数做成ES插件的标准配置参数,这样可以在启动ES的时候通过传递相应的环境变量实现参数的配置,而不用修改插件的配置文件了。在使用Docker搭建ES服务的时候,可以把本插件集成到ES官方镜像中,做成一个新的公共镜像,在创建容器时通过简单的传递环境变量就可以实现热更新字典等相关参数的配置了。

@medcl
Copy link
Member

medcl commented Nov 24, 2020

通过环境变量来覆盖插件配置的方式挺好的,不过需要保证之前的方式也是可以的,新增的配置方式需要兼容之前的场景。

@TanShun
Copy link
Author

TanShun commented Nov 25, 2020

我只是重写了配置方式,没有对参数做处理,原有配置项的作用完全一样,只是把配置文件由IKAnalyzer.cfg.xml改成了IKAnalyzer.yml。因我发现ES提供了一个Settings.builder().loadFromPath(configFile).build()方法,可以直接读取配置项,可是该方法只能读取XContent格式的内容,而这个XContent只有YAML和JSON两种格式,XML不在其支持范围之内。如果要做到兼容,我暂时只想到保留两个配置文件这种方法,但是存在两个作用相同的配置,反而会对配置过程造成困扰。自己写一个读取插件配置的方法难度比较大,因为要做成标准的ES插件配置参数,需要得到ES的认可,不仅仅只是从配置文件中将配置参数读取出来。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants