-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
[Question] The rules before and after loading the configuration file are inconsistent. Can they be improved? #3104
Comments
1. Rules for loading configuration items for the first timeLine 51 in config/file/file.go will determine that the currently loaded configuration configuration is a directory and a special file starting with ".". ignore if yes 2. Use fsnotify to monitor directory changes and load rules afterIn config/file/watcher.go line 55, load all files directly Impact and improvementsFor deployment on Linux, it is very unfriendly to use vim to view the configuration file online. .swp file reports an error and the entire content is printed. Can the following improvements be made: Attached is the scene of vi opening files in the fsnotify monitoring directory |
![Uploading WechatIMG919.jpg…] (Attached is the scene of vi opening the file in the fsnotify monitoring directory) |
🤖 Hello @banfg56, Nice to meet you! I'm Dosu, a bot here to help with issues related to the Kratos repository. I'm here to assist you with bugs, answer your questions, and guide you on how to become a contributor. While we wait for a human maintainer, feel free to ask me anything. Let's get your issue sorted out together! 您的问题与我在Kratos存储库中找到的一个已解决的问题有些相似。在这个问题配置文件加载如果是文件夹,更新配置重新加载则会报错中,建议的解决方案是避免使用在修改配置文件时会创建临时文件的编辑器。相反,应使用不会创建临时文件的编辑器,如Goland IDE。此外,在修改配置文件之前,确保删除任何现有的临时文件(如yaml~)。 关于您提出的改进建议:
希望这些信息对您有所帮助。如果您有任何其他问题或需要进一步的澄清,请随时告诉我。 Sources |
@banfg56 This suggestion looks good. We can add a configuration item in the file source to specify which suffixes are allowed to read files. Can you complete it? |
kindly to ask if there is somebody working for this issue? If not, I'm glad to undertake it @shenqidebaozi |
@CcCJeaz ok |
Hi, @banfg56, I'm helping the Kratos team manage their backlog and am marking this issue as stale. From what I understand, you opened this issue to address inconsistencies in the rules for loading configuration files before and after the initial load, particularly when using fsnotify to monitor directory changes. There have been discussions and potential solutions offered by various contributors, but the issue remains unresolved. Could you please confirm if this issue is still relevant to the latest version of the Kratos repository? If it is, please let the Kratos team know by commenting on the issue. Otherwise, feel free to close the issue yourself, or it will be automatically closed in 7 days. Thank you for your understanding and contributions to Kratos! |
一、第一次Load配置项的规则
在 config/file/file.go 中行51 会判断当前加载配置配置是目录以及 "." 开头的特殊文件。如果是则忽略
二、使用 fsnotify 监控目录变化后加载规则
在 config/file/watcher.go 行55, 直接加载所有文件
影响与改进
对于部署在Linux上,在线用vim查看配置文件很不友好。.swp 文件报错,而且整个内容都打印出来。是否能做以下改进:
[ ] 配置加载时允许指定配置文件格式,比如:json 、ini等
[ ] .swp类型文件记载规则保持一致
附fsnotify监控目录中vi打开文件场景
The text was updated successfully, but these errors were encountered: