Skip to content

Commit

Permalink
Revert "Add redaction control based on environment variables (#7)"
Browse files Browse the repository at this point in the history
Due to the way cargo works .veil.toml can't impact other crates
consistently.

This reverts commit 69dd762.
  • Loading branch information
MaeIsBad committed Sep 22, 2022
1 parent 3e18f1f commit d9df3af
Show file tree
Hide file tree
Showing 24 changed files with 5 additions and 755 deletions.
174 changes: 0 additions & 174 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 2 additions & 14 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,7 @@ license = "MIT"
repository = "https://github.com/primait/veil"

[workspace]
members = [
"veil-macros",
"veil-tests",
"veil-tests/environment-aware",
"veil-tests/environment-aware-fallback-on",
"veil-tests/environment-aware-fallback-off",
"veil-tests/environment-aware-fallback-panic",
"veil-tests/environment-aware-disable",
]

[features]
environment-aware = ["veil-macros/environment-aware", "lazy_static"]
members = ["veil-macros", "veil-tests"]

[dependencies]
veil-macros = { path = "veil-macros" }
lazy_static = { version = "1", optional = true }
veil-macros = { path = "veil-macros" }
37 changes: 0 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,40 +85,3 @@ enum InsuranceStatus {
},
}
```

# Environment Awareness

You can configure Veil to redact or skip redacting data based on environment variables. Enable the `environment-aware` Cargo feature like so in your Cargo.toml:

```toml
[dependencies]
veil = { version = "0.1", features = ["environment-aware"] }
```

## `VEIL_DISABLE_REDACTION`

Redaction can be completely disabled by setting the `VEIL_DISABLE_REDACTION` environment variable. This is only checked once during the program lifetime for security purposes.

## `.veil.toml`

Redaction can also be configured on a per-project basis using a `.veil.toml` file. Put this file in your crate or workspace root and Veil will read it at compile time.

**Please note, if you change the file, Veil won't see the changes until you do a clean build of your crate.**

### Example

`APP_ENV` is just an example here. You can match multiple environment variables with any UTF-8 name and value(s).

```toml
[env.APP_ENV]
redact = ["production", "staging"] # redact data if "APP_ENV" is set to any of these values
skip-redact = ["dev", "qa"] # SKIP redacting data if "APP_ENV" is set to any of these values

# If "APP_ENV" isn't set or isn't recognised...
[fallback]
redact = true # do redact data (default)
# OR
redact = false # don't redact data
# OR
redact = "panic" # panic at runtime
```
37 changes: 0 additions & 37 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,43 +204,6 @@
//! }
//! ```
//!
//! # Environment Awareness
//!
//! You can configure Veil to redact or skip redacting data based on environment variables. Enable the `environment-aware` Cargo feature like so in your Cargo.toml:
//!
//! ```toml
//! [dependencies]
//! veil = { version = "0.1", features = ["environment-aware"] }
//! ```
//!
//! ## `VEIL_DISABLE_REDACTION`
//!
//! Redaction can be completely disabled by setting the `VEIL_DISABLE_REDACTION` environment variable. This is only checked once during the program lifetime for security purposes.
//!
//! ## `.veil.toml`
//!
//! Redaction can also be configured on a per-project basis using a `.veil.toml` file. Put this file in your crate or workspace root and Veil will read it at compile time.
//!
//! **Please note, if you change the file, Veil won't see the changes until you do a clean build of your crate.**
//!
//! ### Example
//!
//! `APP_ENV` is just an example here. You can match multiple environment variables with any UTF-8 name and value(s).
//!
//! ```toml
//! [env.APP_ENV]
//! redact = ["production", "staging"] # redact data if "APP_ENV" is set to any of these values
//! skip-redact = ["dev", "qa"] # SKIP redacting data if "APP_ENV" is set to any of these values
//!
//! ## If "APP_ENV" isn't set or isn't recognised...
//! [fallback]
//! redact = true # do redact data (default)
//! ## OR
//! redact = false # don't redact data
//! ## OR
//! redact = "panic" # panic at runtime
//! ```
//!
//! # Limitations
//!
//! Currently, this macro only supports [`std::fmt::Debug`] formatting with no modifiers (`{:?}`) or the "alternate" modifier (`{:#?}`).
Expand Down
Loading

0 comments on commit d9df3af

Please sign in to comment.