Implement domain configuration layer for environment creation#42
Merged
josecelano merged 2 commits intoOct 25, 2025
Merged
Conversation
Co-authored-by: josecelano <58816+josecelano@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Implement core configuration infrastructure in the domain layer
Implement domain configuration layer for environment creation
Oct 25, 2025
josecelano
approved these changes
Oct 25, 2025
josecelano
marked this pull request as ready for review
October 25, 2025 16:18
Member
|
ACK fea50f4 |
josecelano
deleted the
copilot/implement-core-configuration-infrastructure
branch
April 15, 2026 16:37
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds configuration infrastructure in the domain layer to bridge external configuration sources (JSON, CLI) and the internal domain model for environment creation.
Changes
Configuration Value Objects
EnvironmentCreationConfig- Top-level config withto_environment_params()converting toEnvironment::new()parametersSshCredentialsConfig- Config layer representation (distinct fromadapters::ssh::SshCredentials), supports defaults (username: "torrust", port: 22)EnvironmentSection- Environment-specific settings containerType Conversion
EnvironmentName(validates lowercase, dashes, no leading numbers)Username(validates Linux requirements, 1-32 chars)PathBuf(validates file existence for SSH keys)Error Handling
CreateConfigErrorenum with variants:InvalidEnvironmentName,InvalidUsername,PrivateKeyNotFound,PublicKeyNotFound,InvalidPort.help()providing actionable troubleshooting guidanceModule Structure
Usage
Test Coverage
26 unit tests covering deserialization, type conversion, validation, error handling, and integration with
Environment::new().Part of Epic #34 (Create Environment Command). Enables application command handlers (#36), CLI integration (#37), and E2E tests (#38).
Original prompt
This section details on the original issue you should resolve
<issue_title>[Subissue 1/7] Core Configuration Infrastructure</issue_title>
<issue_description>## Overview
Implement core configuration infrastructure in the domain layer with pure configuration value objects, business validation rules, and explicit error handling.
Parent EPIC: #34 - Implement Create Environment Command
Related: Full Specification | Roadmap Task 1.5
Key Architecture Points
SshCredentialsConfig(distinct fromadapters::ssh::SshCredentials)Username,PathBuf).help()methods (tiered help system pattern)Goals
Create configuration value objects that convert to existing domain types
EnvironmentCreationConfigwithto_environment_params()methodSshCredentialsConfig(config layer) distinct fromadapters::ssh::SshCredentialsshared::UsernametypePathBufEnvironmentName::new()validationConfiguration validation
.help()methodsAdd comprehensive unit tests
Environment::new()parametersUsernametype conversion from stringrepository.save(&environment.into_any())Module Structure
Key Types
EnvironmentCreationConfig
SshCredentialsConfig
Error Types with .help()
Acceptance Criteria
EnvironmentCreationConfigdeserializes from JSONto_environment_params()converts to domain types successfully.help()with detailed guidanceEnvironment::new()verifiedDependencies
Estimated Time
2-3 hours
Notes
.help()methods</issue_description>Comments on the Issue (you are @copilot in this section)
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.