Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make configuration handling a lot better (#141)
* add preliminary support for more advanced configuration options in odilia this is currently using figment as the configuration library, other options include config and simply serde-toml this is not yet complete, as huge refactorings are about to take place * refactor state a bit, to create config.toml from scratch based on default values * refactor State::new to use figment directly * make configuration be working from main, instead of state::new and make state::new accept the configuration structure as a parameter this makes it easier to make, for example, speech have the desired rate from startup, logging be initialised from the config with the desired filter and perhaps a path location, stuff like that * fix: screenreader applies configuration properly the method join replaced the previously used merge. Apparently, with merge, when conflicts are encountered, it preferes keeping the current value, instead of replacing it. So, config was taken from the default values supplied with the modules, but the values in there were never replaced by those who should have a greatter priority. as a consequence, user defined configuration files wouldn't be applied, and the user would understandably be confused by the results * honor configuration when setting the speech rate up to now, configuration was read, but never actually used. This begins a series of changes, perhaps across multiple fronts, to do so. This makes `state::new` send a message on the ssip channel, with the request to set the rate to a user defined value warning: if somehow the ssip task isn't initialized by the point we get there, the change will be lost in the channel, or may be picked up later than intended * env: attempt to parse nested configuration we use nested toml tables in our configuration, one table per what we think to be a logical section. However, because we want to add environment variables as configuration sources, we have to be able to parse nested dictionaries. In order to do that, beside just using .prefix to filter out variables which don't concern us, we must also split the string of the variable name in keys, and for that we try to use the .split method * refactor: move loading of configuration in its own function Cargo format * remove environment variable configuration, as it's not working with our composite configuration keys * fix clippy warning * fix configuration again not joining properly * make logging subsystem use the logging level provided in the configuration file and make the configuration struct easier to use * allow odilia to accept a log file and use it to log information, same for the system journal and tty * specify tty in the config file for logs to be sent to your terminal * use the file option to send it to a file * use syslog for writing to the journal, for systemd equipped distros * add pitch to the configuration * add volume configuration * make output module configurable and run the formatter a bit * add language and voice to the configuration * make punctuation reporting configurable * fix formatting
- Loading branch information