No description
Find a file
Stephan Lo 7b062612f5 refactor(arch): Separate infrastructure from driven adapter
This commit introduces a significant architectural refactoring to decouple the driven adapter from low-level infrastructure concerns, adhering more strictly to the principles of Hexagonal Architecture.

Problem:
The driven adapter in `internal/adapters/driven/edgeconnect` was responsible for both adapting data structures and handling direct HTTP communication, authentication, and request/response logic. This violated the separation of concerns, making the adapter difficult to test and maintain.

Solution:
A new infrastructure layer has been created at `internal/infrastructure`. This layer now contains all the low-level details of interacting with the EdgeConnect API.

Key Changes:
- **New Infrastructure Layer:** Created `internal/infrastructure` to house components that connect to external systems.
- **Generic HTTP Client:** A new, generic `edgeconnect_client` was created in `internal/infrastructure/edgeconnect_client`. It is responsible for authentication, making HTTP requests, and handling raw responses. It has no knowledge of the application's domain models.
- **Config & Transport Moved:** The `config` and `http` (now `transport`) packages were moved into the infrastructure layer, as they are details of how the application is configured and communicates.
- **Consolidated Driven Adapter:** The logic from the numerous old adapter files (`apps.go`, `cloudlet.go`, etc.) has been consolidated into a single, true adapter at `internal/adapters/driven/edgeconnect/adapter.go`.
- **Clear Responsibility:** The new `adapter.go` is now solely responsible for:
  1. Implementing the driven port (repository) interfaces.
  2. Translating domain models into the data structures required by the `edgeconnect_client`.
  3. Calling the `edgeconnect_client` to perform the API operations.
  4. Translating the results back into domain models.
- **Updated Dependency Injection:** The application's entry point (`cmd/cli/main.go`) has been updated to construct and inject dependencies according to the new architecture: `infra_client` -> `adapter` -> `service` -> `cli_command`.
- **SDK & Apply Command:** The SDK examples and the `apply` command have been updated to use the new adapter and its repository methods, removing all direct client instantiation.
2025-10-09 00:47:45 +02:00
.claude feat(apply): Implement EdgeConnect configuration parsing foundation 2025-09-29 16:18:35 +02:00
.github/workflows ci: Added test workflow running on each push except tags 2025-10-07 16:10:02 +02:00
api feat(sdk): Implement EdgeXR Master Controller Go SDK foundation 2025-09-25 14:05:20 +02:00
cmd/cli refactor(arch): Separate infrastructure from driven adapter 2025-10-09 00:47:45 +02:00
internal refactor(arch): Separate infrastructure from driven adapter 2025-10-09 00:47:45 +02:00
sdk refactor(arch): Separate infrastructure from driven adapter 2025-10-09 00:47:45 +02:00
.envrc.example chore: Added flake 2025-10-07 14:37:54 +02:00
.gitignore chore: Added flake 2025-10-07 14:37:54 +02:00
.goreleaser.yaml fix(cli): Force usage of gitea token 2025-10-02 13:44:28 +02:00
apply-todo.md feat(apply): Implement CLI command with comprehensive deployment workflow 2025-09-29 17:24:59 +02:00
apply.md chore(cli): Removed appName from config schema. This is redundant to metadata name 2025-09-30 11:33:52 +02:00
config.yaml.example feat(cli): Implement Edge Connect CLI tool 2025-09-18 13:51:09 +02:00
devbox.json chore(): unique go version 1.25, fixes 'make test-coverage' error 2025-10-08 16:49:31 +02:00
devbox.lock chore(): unique go version 1.25, fixes 'make test-coverage' error 2025-10-08 16:49:31 +02:00
Dockerfile feat(client): add basic client, model 2025-09-16 13:02:33 +02:00
flake.lock chore: Added flake 2025-10-07 14:37:54 +02:00
flake.nix chore(): unique go version 1.25, fixes 'make test-coverage' error 2025-10-08 16:49:31 +02:00
go.mod feat(apply): Implement deployment planning with intelligent state comparison 2025-09-29 16:36:21 +02:00
go.sum feat(apply): Implement deployment planning with intelligent state comparison 2025-09-29 16:36:21 +02:00
hexagonal-architecture-proposal.md feat: implement dependency injection with proper hexagonal architecture 2025-10-08 18:15:26 +02:00
Makefile feat: implement dependency injection with proper hexagonal architecture 2025-10-08 18:15:26 +02:00
plan.md feat(apply): Implement EdgeConnect configuration parsing foundation 2025-09-29 16:18:35 +02:00