mirror of
https://github.com/rwf2/Rocket.git
synced 2025-01-31 13:52:08 +00:00
Warn when deprecated profiles are set.
This commit is contained in:
parent
28976a5bd3
commit
43ade920c5
@ -114,6 +114,10 @@ impl Config {
|
|||||||
("env", Some("profile")), ("log", Some("log_level")),
|
("env", Some("profile")), ("log", Some("log_level")),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const DEPRECATED_PROFILES: &'static [(&'static str, Option<&'static str>)] = &[
|
||||||
|
("dev", Some("debug")), ("prod", Some("release")),
|
||||||
|
];
|
||||||
|
|
||||||
/// Returns the default configuration for the `debug` profile, irrespective
|
/// Returns the default configuration for the `debug` profile, irrespective
|
||||||
/// of the compilation profile. For the default Rocket will use, which is
|
/// of the compilation profile. For the default Rocket will use, which is
|
||||||
/// chosen based on the configuration profile, call [`Config::default()`].
|
/// chosen based on the configuration profile, call [`Config::default()`].
|
||||||
@ -303,6 +307,19 @@ impl Config {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check for now removed config values.
|
||||||
|
for (prefix, replacement) in Self::DEPRECATED_PROFILES {
|
||||||
|
if let Some(profile) = figment.profiles().find(|p| p.starts_with(prefix)) {
|
||||||
|
warn!("found set deprecated profile `{}`", Paint::white(profile));
|
||||||
|
|
||||||
|
if let Some(new_profile) = replacement {
|
||||||
|
info_!("profile has been by replaced by `{}`", Paint::white(new_profile));
|
||||||
|
} else {
|
||||||
|
info_!("profile `{}` has no special meaning", profile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user