Skip to main content

torrust_tracker_deployer_lib/application/command_handlers/render/
mod.rs

1//! Render Command Module
2//!
3//! This module implements the delivery-agnostic `RenderCommandHandler`
4//! for generating deployment artifacts without executing deployment operations.
5//!
6//! ## Architecture
7//!
8//! The `RenderCommandHandler` implements the Command Pattern and uses Dependency Injection
9//! to interact with infrastructure services through interfaces:
10//!
11//! - **Repository Pattern**: Loads environment state via `EnvironmentRepository` (env-name mode)
12//! - **Template Generation**: Renders all deployment artifacts to build directory
13//! - **Domain-Driven Design**: Uses domain objects from `domain::environment`
14//!
15//! ## Design Principles
16//!
17//! - **Delivery-Agnostic**: Works with CLI, REST API, or any delivery mechanism
18//! - **Read-Only Operations**: Does not modify environment state or execute deployments
19//! - **Dual Input Modes**: Supports both existing environments and direct config files
20//! - **Explicit Errors**: All errors implement `.help()` with actionable guidance
21//! - **Output Separation**: Requires explicit output directory to prevent conflicts with provision artifacts
22//!
23//! ## State Constraints
24//!
25//! - **Created State Only**: Command only works for environments in "Created" state
26//! - **IP Always Required**: User must provide target IP via --instance-ip flag
27//! - **Output Directory Required**: User must provide output directory via --output-dir flag
28//! - **Force Flag**: Use --force to overwrite existing output directory
29//!
30//! ## Dual Input Modes
31//!
32//! 1. **Environment Name Mode** (`--env-name`):
33//!    - Loads existing environment from repository
34//!    - Validates state is "Created"
35//!    - Uses environment configuration
36//!
37//! 2. **Config File Mode** (`--env-file`):
38//!    - Parses configuration file directly
39//!    - No environment creation or persistence
40//!    - Validates configuration only
41
42pub mod errors;
43pub mod handler;
44
45pub use errors::RenderCommandHandlerError;
46pub use handler::{RenderCommandHandler, RenderInputMode, RenderResult};