Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the environmental awareness feature #16

Merged
merged 15 commits into from
Sep 26, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,6 @@ enum InsuranceStatus {
```

# Skip redacting data
In testing environments it may be useful not to censor your logs. You can globally disable Veil's redaction behavior at runtime by calling the `disable` function(locked behind the *non-default* `toggle` feature flag.) See this [example](examples/disable_redaction.rs)
In testing environments it may be useful not to censor your logs.You can globally disable Veil's redaction behavior at runtime by enabling the *non-default* feature flag `toggle` and:
MaeIsBad marked this conversation as resolved.
Show resolved Hide resolved
- Setting the VEIL_DISABLE_REDACTION environment variable.
MaeIsBad marked this conversation as resolved.
Show resolved Hide resolved
- Calling the `disable` function(locked behind the *non-default* `toggle` feature flag). See this [example](examples/disable_redaction.rs).
6 changes: 5 additions & 1 deletion src/toggle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ pub fn disable() -> Result<(), RedactionBehavior> {

/// Get the current debug format value
pub(crate) fn get_redaction_behavior() -> RedactionBehavior {
*DEBUG_FORMAT.get_or_init(|| RedactionBehavior::Redact)
if let "1" | "on" = std::env::var("VEIL_DISABLE_REDACTION").unwrap_or_default().as_str() {
*DEBUG_FORMAT.get_or_init(|| RedactionBehavior::Plaintext)
} else {
*DEBUG_FORMAT.get_or_init(|| RedactionBehavior::Redact)
}
}

#[cfg(test)]
Expand Down