Disabled JSON support by default.

This commit is contained in:
Aaron Weiss 2018-01-27 21:10:22 +01:00
parent 6550bd0d96
commit 518303a013
No known key found for this signature in database
GPG key ID: 047D32DF25DC22EF
3 changed files with 8 additions and 10 deletions

View file

@ -14,7 +14,7 @@ readme = "README.md"
travis-ci = { repository = "aatxe/irc" } travis-ci = { repository = "aatxe/irc" }
[features] [features]
default = ["ctcp", "json", "toml"] default = ["ctcp", "toml"]
ctcp = [] ctcp = []
nochanlists = [] nochanlists = []
json = ["serde_json"] json = ["serde_json"]

View file

@ -74,12 +74,10 @@ fn main() {
Like the rest of the IRC crate, configuration is built with flexibility in mind. You can easily Like the rest of the IRC crate, configuration is built with flexibility in mind. You can easily
create `Config` objects programmatically and choose your own methods for handling any saving or create `Config` objects programmatically and choose your own methods for handling any saving or
loading of configuration required. However, for convenience, we've also included the option of loading of configuration required. However, for convenience, we've also included the option of
loading files with `serde` to write configurations. By default, we support JSON and TOML. As of loading files with `serde` to write configurations. The default configuration format is TOML,
0.12.4, TOML is the preferred configuration format. We have bundled a conversion tool as though there is optional support for JSON and YAML via the optional `json` and `yaml` features. All
`convertconf` in the examples. In a future version, we will likely disable JSON by default. the configuration fields are optional, and can thus be omitted, but a working configuration requires
Additionally, you can enable the optional `yaml` feature to get support for YAML as well. All the at least a `server` and `nickname`.
configuration fields are optional, and thus any of them can be omitted (though, omitting a
nickname or server will cause the program to fail for obvious reasons).
Here's an example of a complete configuration in TOML: Here's an example of a complete configuration in TOML:

View file

@ -1,3 +1,3 @@
echo "{\"owners\": [\"test\"],\"nickname\": \"test\",\"username\": \"test\",\"realname\": \"test\",\"password\": \"\",\"server\": \"irc.test.net\",\"port\": 6667,\"use_ssl\": false,\"encoding\": \"UTF-8\",\"channels\": [\"#test\", \"#test2\"],\"umodes\": \"+BR\",\"options\": {}}" > client_config.json echo "{\"owners\": [\"test\"],\"nickname\": \"test\",\"username\": \"test\",\"realname\": \"test\",\"password\": \"\",\"server\": \"irc.test.net\",\"port\": 6667,\"use_ssl\": false,\"encoding\": \"UTF-8\",\"channels\": [\"#test\", \"#test2\"],\"umodes\": \"+BR\",\"options\": {}}" > client_config.json
cargo run --example convertconf --features "toml yaml" -- -i client_config.json -o client_config.toml cargo run --example convertconf --features "json yaml" -- -i client_config.json -o client_config.toml
cargo run --example convertconf --features "toml yaml" -- -i client_config.json -o client_config.yaml cargo run --example convertconf --features "json yaml" -- -i client_config.json -o client_config.yaml