aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-config/src/load.rs
Commit message (Collapse)AuthorAgeFilesLines
* maint: Run maint/add_warning to deny string slicesClara Engler2026-06-091-0/+1
| | | | | | | | | | | | This commit executes maint/add_warning with the just added change to deny string slices except in tests. I recommend auditing this by checking out the previous commit followed by running the script yourself and then verifying that the diff is identical to this commit. This commit makes cargo clippy fail. We will add exceptions in the next commit.
* config: Simplify ConfigurationTree::merge_from to take &mut self.Nick Mathewson2026-05-271-2/+2
|
* config: Update doctests to use Deftly, and to passNick Mathewson2026-05-271-4/+11
| | | | | | | | Some of the tests used derive(Builder), which is not current practice for our configuration. Additionally, they didn't implement the requisite ConfigBuilder logic to pass with the other changes in this branch.
* Give resolve_return_results options to control output_tree.Nick Mathewson2026-05-271-13/+48
| | | | | | | I've left the options here as booleans, but moved them into a struct. (IMO, booleans are at their riskiest when they are passed as function arguments, and much less risky when they are used as struct fields.)
* config: Add an `output_tree` to our resolver methods.Nick Mathewson2026-05-271-5/+33
| | | | | | This functionality exposes the part of the configuration tree that was actually used, along with any defaulted values. RPC will want this.
* config: Add a method to fill in a builder with unset defaultsNick Mathewson2026-05-271-0/+21
| | | | | | | | | | | | | | | This new method modifies a builder by replacing any unset values that have a default with that default. We're using this method so that we can re-serialize a builder into a `ConfigurationTree` with all of its default values included. In all cases, `b.apply_defaults()?; b.build()` should produce the same output as `b.build()`. The interesting parts of this commit are in tor_config::load and tor_config::derive. The rest of this commit just adds `apply_defaults` to other builders that _aren't_ made with `derive_deftly(TorConfig)`.
* config: Fix documentation of ResolutionResultsNick Mathewson2026-05-271-1/+1
| | | | It previously referred to a function that didn't exist.
* config: Convert some load.rs tests to use dd(TorConfig).Nick Mathewson2026-05-181-18/+11
|
* tor-config: remove a needless clone.Nick Mathewson2026-05-181-1/+1
|
* tor-config: small typo fix in docsSteven Engler2026-01-071-1/+2
|
* tor-config: New Buildable trait.Nick Mathewson2025-12-091-2/+18
| | | | | | | | This trait will be implemented by every type that our derive_deftly(TorConfig) template generates. It will, among other things, help us figure out the Builder type for a given config type in cases where string-pasting magic is intractable, or where we want to use assert_not_impl to double-check the attributes.
* Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-061-1/+1
| | | | Run maint/add_warning
* Switch Cargo.toml files to edition 2024.Nick Mathewson2025-08-071-2/+2
| | | | | | | | | | | | | | First, run ``` git grep -l "^edition =" | xargs perl -i -pe 's/^edition *=.*/edition = "2024"/;' ``` Second, manually verify that all Cargo.toml files have changed, and nothing else has changed. Third, run cargo fmt again.
* tor-config: fix `clippy::double_ended_iterator_last`Steven Engler2025-04-031-1/+1
| | | | | | | | | | | | | | | | | | ```text warning: called `Iterator::last` on a `DoubleEndedIterator`; this will needlessly iterate the entire iterator --> crates/tor-config/src/load.rs:606:18 | 606 | .last() | ^^^^^^ help: try: `next_back()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#double_ended_iterator_last note: the lint level is defined here --> crates/tor-config/src/lib.rs:9:9 | 9 | #![warn(clippy::all)] | ^^^^^^^^^^^ = note: `#[warn(clippy::double_ended_iterator_last)]` implied by `#[warn(clippy::all)]` ```
* Switch to figment 1.0.18 and extract_lossyNick Mathewson2024-04-221-2/+2
| | | | | | | The new (dubiously named) `Figment::extract_lossy` method can treat decode numbers from strings, and booleans from numbers or strings. This makes the behavior compatible with config-rs, and should (I hope) finally allow us to migrate.
* Convert tor-config to use figment.Nick Mathewson2024-04-221-20/+53
| | | | | There are probably ways to make this a bit more elegant, but at least the tests still pass.
* Merge branch 'encapsulate_config_rs' into 'main'Nick Mathewson2024-03-131-31/+31
|\ | | | | | | | | Encapsulate usage of config-rs inside tor-config. See merge request tpo/core/arti!2040
| * tor-config: Update documentation to not refer to config crate.Nick Mathewson2024-03-131-4/+4
| |
| * config: Remove From impls from config::ConfigErrorNick Mathewson2024-03-131-7/+1
| | | | | | | | These are another case of exposing the config crate.
| * tor-config: Put config::Config inside a wrapper type.Nick Mathewson2024-03-131-9/+9
| | | | | | | | This will let us replace Config with something better.
| * Use ConfigurationSource::Verbatim in our tests.Nick Mathewson2024-03-131-11/+17
| |
* | Run maint/add_warning.Nick Mathewson2024-03-131-0/+1
|/
* Run maint/add_warning to add lint block everywhereIan Jackson2023-08-231-0/+1
|
* Run maint/add_warning to actually apply new lint allowsIan Jackson2023-07-101-0/+1
|
* Allow clippy::unchecked_duration_subtraction in testsNick Mathewson2023-01-271-0/+1
| | | | | This panics on error, and we're fine with a panic on misbehavior in tests.
* test lint blocks: Do some semi-manuallyIan Jackson2022-12-121-1/+9
| | | | | | | This is the hunks from running the rune in maint/adhoc-add-lint-blocks but which require some subsequent manual fixup: usually, deleting now-superfluous outer allows, but in some cases manually putting back lints that the adhoc script deleted.
* Merge branch 'refactor-anyhow-arti-crate' into 'main'Nick Mathewson2022-08-311-1/+1
|\ | | | | | | | | Remove `anyhow` from `tor-config` crate See merge request tpo/core/arti!707
| * Remove `anyhow` from `tor-config` crateArturo Marquez2022-08-281-1/+1
| |
* | tor-config: DisfavouredKey: Linkify DisplayIan Jackson2022-08-301-1/+1
| |
* | tor-config: DisfavouredKey: Widen applicability of .to_string()Ian Jackson2022-08-301-1/+1
| | | | | | | | And linkify it.
* | Add documentation note on `to_string()` usage for DisfavouredKey.Alexander Færøy2022-08-301-0/+2
|/
* Improve error from bad escapes in a toml config.Nick Mathewson2022-08-251-1/+7
| | | | | | | | | | | | | | | | | Whereas previously we would say: ``` target/debug/arti: error: invalid escape character in string: `Z` at line 9 column 14 in ../../.config/arti/arti.toml ``` we now say: ``` target/debug/arti: error: invalid escape character in string: `Z` at line 9 column 14 in ../../.config/arti/arti.toml (If you wanted to include a literal \ character, you need to escape it by writing two in a row: \\) ``` The implementation is a bit of a hack, I'm afraid, but I don't think it's all that bad. Closes #549.
* tor-config: Support tracking deprecated config keysIan Jackson2022-08-251-9/+68
|
* tor-config: Introduce ResolutionResultsIan Jackson2022-08-251-19/+41
| | | | This will allow us to handle new kinds of warnigns etc.
* tor-config: Rename UnrecognizedKey to DisfavouredKeyIan Jackson2022-08-251-18/+18
| | | | We're going to want the to use the same type for deprecated keys.
* fix nighly clippytrinity-1686a2022-07-231-1/+1
|
* tor-config: Don't format source error as part of error messageNick Mathewson2022-06-221-2/+2
| | | | This is one I missed earlier.
* Fix typosDimitris Apostolou2022-06-051-3/+3
|
* Merge branch 'tor-config-tests' into 'main'Nick Mathewson2022-05-311-0/+61
|\ | | | | | | | | Add a few coverage-based tests to tor-config. See merge request tpo/core/arti!540
| * Add a few coverage-based tests to tor-config.Nick Mathewson2022-05-311-0/+61
| | | | | | | | There's nothing major here, but it does fill in a few gaps.
* | Fix a link with nightly rustdocNick Mathewson2022-05-261-1/+1
|/
* tor-config: load: clippy: adopt two suggestionsIan Jackson2022-05-261-3/+2
| | | | We can have mem::take, hooray.
* tor-config: load: Add missing "not".Ian Jackson2022-05-261-1/+1
| | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/529#note_2807331
* tor-config: load: Make UnrecognizedKeys not pubIan Jackson2022-05-261-1/+1
| | | | | | | This was a slip. As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/529#note_2807330
* tor-config: load: Add reversed testIan Jackson2022-05-251-0/+3
|
* tor-config: Add duplicative doc comments as per reviewIan Jackson2022-05-251-1/+6
|
* tor-config: load: example: Document what it does and who might write itIan Jackson2022-05-251-0/+16
|
* tor-config: load: Add a newlineIan Jackson2022-05-251-0/+1
| | | | This makes the function a tiny bit clearer.
* tor-config: load: Write actual definition of the Resolvable traitIan Jackson2022-05-251-2/+18
| | | | | This is not a doc comment because we don't want it to be public: it must refer to private fields, etc.
* tor-config: load: Explain why not write out macro call n timesIan Jackson2022-05-251-0/+2
|