Stricter config checking
Closed this issue · 2 comments
SuperSandro2000 commented
I had the following invalid config:
nix-repl> :p nixosConfigurations.hydrogen.config.services.harmonia.settings
{ bind = "[::]:8094"; settings = { priority = 50; }; }
And Harmonia didn't do any type checking on it and just ignored it:
Feb 12 11:09:33 hydrogen systemd[1]: Started harmonia binary cache service.
Feb 12 11:09:33 hydrogen harmonia[311971]: [2024-02-12T10:09:33Z INFO harmonia] listening on [::]:8094
Feb 12 11:09:33 hydrogen harmonia[311971]: [2024-02-12T10:09:33Z INFO actix_server::builder] starting 4 workers
Feb 12 11:09:33 hydrogen harmonia[311971]: [2024-02-12T10:09:33Z INFO actix_server::server] Actix runtime found; starting in Actix runtime
Also the module has very open types for the setting option and it would probably be better for type checking if we used more strict types.
PS: The settings option also is different from this repo and nixpkgs.
Mic92 commented
Probably needs a different toml implementation than:
https://docs.rs/toml/latest/toml/de/fn.from_str.html
Otherwise given that most people will use NixOS for harmonia, we might use json as well.
jalil-salame commented
Wouldn't #[serde(deny_unknown_fields)] fix this?