mirror of https://github.com/rwf2/Rocket.git
Generate a secret key in debug only if it is zero.
This prevents printing a secret key warning if a secret key was generated, as is done by Rocket itself. This does not change any behaviors in non-debug profiles.
This commit is contained in:
parent
c9d7b4fbe0
commit
bc38196f8d
|
@ -538,11 +538,11 @@ impl Rocket {
|
|||
let profile = self.figment.profile();
|
||||
if profile != Config::DEBUG_PROFILE {
|
||||
return Err(Error::new(ErrorKind::InsecureSecretKey(profile.clone())));
|
||||
} else {
|
||||
} else if self.config.secret_key.is_zero() {
|
||||
self.config.secret_key = crate::config::SecretKey::generate()
|
||||
.unwrap_or(crate::config::SecretKey::zero());
|
||||
|
||||
warn!("secrets enabled without a configured `secret_key`");
|
||||
warn!("secrets enabled without a stable `secret_key`");
|
||||
info_!("disable `secrets` feature or configure a `secret_key`");
|
||||
info_!("this becomes an {} in non-debug profiles", Paint::red("error"));
|
||||
|
||||
|
|
Loading…
Reference in New Issue