-
Couldn't load subscription status.
- Fork 0
Description
Parent Epic: #34 - Implement Create Environment Command
Status: OPTIONAL ENHANCEMENT
Estimated Time: 2-3 hours
⚠️ Note: This is an optional enhancement that can be deferred. It is not required for the MVP functionality of the create command.
Overview
Implement the template system for configuration file generation in the infrastructure layer. This system provides embedded JSON configuration templates that can be generated on-demand, supporting the --generate-template functionality with proper error handling and validation.
Goals
- Extend existing
TemplateManagerfromsrc/domain/template/embedded.rsfor configuration templates- Use existing template infrastructure - no duplication needed
- Add configuration template types to existing embedded template system
- Leverage existing rust-embed pattern in
templates/directory structure - Use existing
TemplateManagerErrorfor error handling
- Add configuration templates to existing template structure
- Add to existing
templates/directory following existing patterns - Use existing Tera variable syntax:
{{ variable_name }}(not{ { variable_name } }) - Follow existing template embedding and extraction patterns
- Add to existing
- Add
--generate-templatefunctionality using existing template infrastructure - Add unit tests that integrate with existing template system
Architecture Requirements
DDD Layer: Infrastructure Layer (src/infrastructure/templates/)
Pattern: Template Provider + Embedded Resources + File Operations
Dependencies: None (infrastructure concern)
Template Example
{
"environment": {
"name": "{{ environment_name }}"
},
"ssh_credentials": {
"private_key_path": "{{ ssh_private_key_path }}",
"public_key_path": "{{ ssh_public_key_path }}",
"username": "{{ ssh_username }}",
"port": {{ ssh_port }}
}
}Acceptance Criteria
- Template provider extends existing
TemplateManagerinfrastructure - Templates use correct Tera variable syntax:
{{ variable }} - Templates generate valid JSON files
- Error handling follows tiered help system pattern
- Unit tests verify template generation works correctly
- Integration tests verify file system operations
- Templates are embedded in binary using existing rust-embed pattern
Implementation Notes
- Reuse existing
TemplateManagerfromsrc/domain/template/embedded.rs - Add configuration templates to
templates/directory structure - Use existing error types from template system
- Follow patterns established in OpenTofu/Ansible template management
For detailed specification, see: docs/issues/epic-create-environment-command-subissue-6-template-system-integration.md