Implement container logs handler
- Add Docker client to handlers for container operations - Implement HandleAppLogs() to fetch and return container logs - Support ?tail=N query parameter (default 500 lines) - Handle missing container gracefully
This commit is contained in:
@@ -86,7 +86,7 @@ func createAppServices(
|
||||
logInstance *logger.Logger,
|
||||
dbInstance *database.Database,
|
||||
cfg *config.Config,
|
||||
) (*auth.Service, *app.Service, *deploy.Service, *webhook.Service) {
|
||||
) (*auth.Service, *app.Service, *deploy.Service, *webhook.Service, *docker.Client) {
|
||||
t.Helper()
|
||||
|
||||
authSvc, authErr := auth.New(fx.Lifecycle(nil), auth.ServiceParams{
|
||||
@@ -128,7 +128,7 @@ func createAppServices(
|
||||
})
|
||||
require.NoError(t, webhookErr)
|
||||
|
||||
return authSvc, appSvc, deploySvc, webhookSvc
|
||||
return authSvc, appSvc, deploySvc, webhookSvc, dockerClient
|
||||
}
|
||||
|
||||
func setupTestHandlers(t *testing.T) *testContext {
|
||||
@@ -138,7 +138,7 @@ func setupTestHandlers(t *testing.T) *testContext {
|
||||
|
||||
globalInstance, logInstance, dbInstance, hcInstance := createCoreServices(t, cfg)
|
||||
|
||||
authSvc, appSvc, deploySvc, webhookSvc := createAppServices(
|
||||
authSvc, appSvc, deploySvc, webhookSvc, dockerClient := createAppServices(
|
||||
t,
|
||||
logInstance,
|
||||
dbInstance,
|
||||
@@ -156,6 +156,7 @@ func setupTestHandlers(t *testing.T) *testContext {
|
||||
App: appSvc,
|
||||
Deploy: deploySvc,
|
||||
Webhook: webhookSvc,
|
||||
Docker: dockerClient,
|
||||
},
|
||||
)
|
||||
require.NoError(t, handlerErr)
|
||||
|
||||
Reference in New Issue
Block a user