pub struct HttpsConfig { /* private fields */ }Expand description
Domain-level HTTPS configuration for TLS termination
Contains validated HTTPS settings used for Caddy reverse proxy configuration.
This type is created from the application-layer DTO (HttpsSection) after
validation and stored in the environment.
§Let’s Encrypt Environments
- Production (default): Trusted certificates, rate-limited
- Staging: Untrusted test certificates, higher rate limits
§Example
use torrust_tracker_deployer_lib::domain::https::HttpsConfig;
let config = HttpsConfig::new("admin@example.com", false).unwrap();
assert_eq!(config.admin_email(), "admin@example.com");
assert!(!config.use_staging());Implementations§
Source§impl HttpsConfig
impl HttpsConfig
Sourcepub fn new(
admin_email: impl Into<String>,
use_staging: bool,
) -> Result<Self, HttpsConfigError>
pub fn new( admin_email: impl Into<String>, use_staging: bool, ) -> Result<Self, HttpsConfigError>
Creates a new HTTPS configuration with validated email
Validates the admin email format at construction time, ensuring the configuration is always valid.
§Arguments
admin_email- Admin email for Let’s Encrypt notificationsuse_staging- Whether to use staging environment
§Errors
Returns HttpsConfigError::InvalidEmail if the email format is invalid.
§Examples
use torrust_tracker_deployer_lib::domain::https::HttpsConfig;
// Production configuration
let config = HttpsConfig::new("admin@example.com", false).unwrap();
assert!(!config.use_staging());
// Staging configuration (for testing)
let staging = HttpsConfig::new("admin@example.com", true).unwrap();
assert!(staging.use_staging());
// Invalid email is rejected
let result = HttpsConfig::new("invalid-email", false);
assert!(result.is_err());Sourcepub fn from_validated_email(email: &Email, use_staging: bool) -> Self
pub fn from_validated_email(email: &Email, use_staging: bool) -> Self
Creates an HTTPS config from a validated email
This is the preferred factory method when working with validated email addresses from the application layer. Since the email is already validated, this method is infallible.
§Arguments
email- Validated email addressuse_staging- Whether to use staging environment
Sourcepub fn admin_email(&self) -> &str
pub fn admin_email(&self) -> &str
Returns the admin email address
Sourcepub fn use_staging(&self) -> bool
pub fn use_staging(&self) -> bool
Returns whether to use Let’s Encrypt staging environment
Trait Implementations§
Source§impl Clone for HttpsConfig
impl Clone for HttpsConfig
Source§fn clone(&self) -> HttpsConfig
fn clone(&self) -> HttpsConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for HttpsConfig
impl Debug for HttpsConfig
Source§impl Default for HttpsConfig
impl Default for HttpsConfig
Source§impl<'de> Deserialize<'de> for HttpsConfig
impl<'de> Deserialize<'de> for HttpsConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for HttpsConfig
impl PartialEq for HttpsConfig
Source§impl Serialize for HttpsConfig
impl Serialize for HttpsConfig
impl Eq for HttpsConfig
impl StructuralPartialEq for HttpsConfig
Auto Trait Implementations§
impl Freeze for HttpsConfig
impl RefUnwindSafe for HttpsConfig
impl Send for HttpsConfig
impl Sync for HttpsConfig
impl Unpin for HttpsConfig
impl UnsafeUnpin for HttpsConfig
impl UnwindSafe for HttpsConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request