2. Inject dependencies
The dependencies are handled by the Application Container
. The torpedo fire
command will generated the basis for the application
and more dependency modules can be added.
Torpedo will generate out of the box the following dependency modules:
Module | Description |
---|---|
logger | Provides a log instance based on log/slog |
http_server | Provides a HTTP server based on Gin |
storage_key | Provides a 32 bytes key required for encryption at storage layer |
The file dependency/init.go
contains all the injected modules required for the application and it is the place to add more custom modules.
Additionally, per each defined entity and use case an injection module will be created where the repository settings and others can be configured.
Following the Booking Fly app example, the auto generated init.go
file should look like:
For further information please read the section Application Container