In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Background
We know that the mainstream configuration file format is xml,json,toml,yaml, and here I'll take toml as an example, because our project uses a configuration file in toml format. Once, when the code was released online, the validity of the toml configuration file was not verified. After the configuration was pushed up, the program did not start properly, resulting in the service being unavailable.
Thinking
After this error, I think we should be able to verify the validity of the configuration file in advance before releasing the code, so as to avoid low-level human error.
Push the wrong configuration file online, so you want to find a tool that can verify the validity of the toml profile.
In the solution, golang needs to be installed here, assuming that in the linux environment
Get the source code
Go get github.com/BurntSushi/toml
Go to the directory github.com/BurntSushi/tomlcmd/tomlv and compile
Go build.
Then put tomlv in the / bin directory. Verify the validity of the toml configuration file, using the following:
Tomlv some-toml-file.toml
If the error will have output, such as
Error in 'config.conf': Near line 1 (last key parsed' service'): expected a top-level item to end with a newline, comment, or EOF, but got'] 'instead
We can then judge whether the verification is successful or not based on the return status of the command, 0 successful and 1 failed.
Also view the various types of configuration items for toml:
Tomlv-types some-toml-file.toml
The results are as follows:
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.