Skip to main content

Module params

Module params 

Source
Expand description

Environment Creation Parameters

This module provides EnvironmentParams, a domain value object that holds all validated parameters needed to create an Environment aggregate.

§DDD Pattern: Factory Input

This is a value object that groups all the inputs required by the Environment::create() factory method. It provides:

  • Named fields: Self-documenting, no positional confusion
  • Type safety: All fields are validated domain types
  • Clean API: Single parameter instead of 10+ arguments

§Architecture

EnvironmentCreationConfig (DTO - Application Layer)
        │
        │ TryFrom (in Application Layer)
        ▼
EnvironmentParams (Domain Value Object)
        │
        │ Environment::create(params, working_dir, timestamp)
        ▼
Environment<Created> (Domain Aggregate)

The TryFrom implementation lives in the Application layer since it needs to reference the DTO, but EnvironmentParams itself is a pure domain type.

§Usage

use torrust_tracker_deployer_lib::domain::environment::EnvironmentParams;
use torrust_tracker_deployer_lib::domain::{EnvironmentName, InstanceName};

// EnvironmentParams is typically constructed via TryFrom in application layer
// or directly in domain tests

Structs§

EnvironmentParams
Parameters for creating a new Environment aggregate