-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove the environmental awareness feature (#16)
* Revert "Add redaction control based on environment variables (#7)" Due to the way cargo works .veil.toml can't impact other crates consistently. This reverts commit 69dd762. * Remove all mentions of the environment aware feature * Add a set_debug_format function This is a simpler replacement for the environmental awareness feature. * Mention being able to skip redacting data * Move tests that disable redaction into a separate crate This is neccessary because rust runs all tests in the same process, leading to tests failing randomly, because of other tests modifying the global state. There is some proposal on the rust compiler-team github repo but until that gets stabilized we have to use this hack instead rust-lang/compiler-team#508 * Loosen the version requirement of once_cell to 1.0.0 Co-authored-by: William <[email protected]> * Hide the disable feature behind a feature flag Ensure that the use of this feature requires a very explicit opt-in from the user. * Add support for disabling veil with VEIL_DISABLE_REDACTION * Test the toggle feature with drone * Minor fixes to disable-redaction-test * Rename it to veil-tests-disable-redaction * Set publish = false * Change the outer line doc comment describing the test into a inner line doc comment * Improve the disable veil redaction docs This avoids repeating that the disable function needs the toggle feature flag which makes it clearer that the VEIL_DISABLE_REDACTION envar also needs the feature flag * Clarify RedactionBehavior doc comment Co-authored-by: William <[email protected]> * Add missing space in README.md * Update README.md Make it clear that to skip redacting data the user needs to either call the disable function *or* set the VEIL_DISABLE_REDACTION variable, not both. * Update outdated comment in the disable_redaction example Co-authored-by: mae.kasza <[email protected]> Co-authored-by: William <[email protected]>
- Loading branch information
1 parent
3e18f1f
commit e2d8ffc
Showing
28 changed files
with
134 additions
and
737 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use std::env; | ||
use veil::Redact; | ||
|
||
#[derive(Redact)] | ||
pub struct Customer { | ||
#[redact(partial)] | ||
first_name: String, | ||
} | ||
|
||
fn main() { | ||
// If the environment variable APP_ENV is set to "dev" veil will not redact anything | ||
if let Ok(env) = env::var("APP_ENV") { | ||
if env == "dev" { | ||
// Note that veil::disable needs the `toggle` feature flag enabled | ||
veil::disable().unwrap(); | ||
} | ||
} | ||
|
||
println!( | ||
"{:#?}", | ||
Customer { | ||
first_name: "John".to_string(), | ||
} | ||
); | ||
} |
Oops, something went wrong.