mirror of
https://github.com/rwf2/Rocket.git
synced 2024-12-31 23:02:37 +00:00
83ffe0f7bc
This commit makes the `Config.secret_key` conditionally compile on the `secrets` feature. The net effect is simplified internal code, fewer corner-cases, and easier to write tests. This commit removes the `Provider::profile()` implementation of `Config`. This means that the `Config` provider no longer sets a profile, a likely confusing behavior. The `Config::figment()` continues to function as before.
15 lines
461 B
Rust
15 lines
461 B
Rust
#![cfg(feature = "secrets")]
|
|
|
|
use rocket::figment::Figment;
|
|
use rocket::config::{Config, SecretKey};
|
|
|
|
#[test]
|
|
fn secret_key_in_config_not_zero() {
|
|
let original_key = SecretKey::generate().expect("get key");
|
|
|
|
let config = Config { secret_key: original_key.clone(), ..Default::default() };
|
|
let figment = Figment::from(config);
|
|
let figment_key: SecretKey = figment.extract_inner("secret_key").unwrap();
|
|
assert_eq!(original_key, figment_key);
|
|
}
|