Add 'tls_enabled' method to Config.

This commit is contained in:
Kyle Clemens 2018-05-13 18:34:32 -04:00 committed by Sergio Benitez
parent 162bf19c72
commit 070529e1ac
1 changed files with 11 additions and 0 deletions

View File

@ -651,6 +651,17 @@ impl Config {
self.extras.iter().map(|(k, v)| (k.as_str(), v))
}
/// Returns `true` if TLS is enabled.
///
/// Always returns `false` if the `tls` compilation feature is not enabled.
pub fn tls_enabled(&self) -> bool {
if cfg!(feature = "tls") {
self.tls.is_some()
} else {
false
}
}
/// Retrieves the secret key from `self`.
#[inline]
pub(crate) fn secret_key(&self) -> &Key {