Fix runtime bugs, implement service layer, and overhaul documentation

Runtime fixes:
- Fix env var mismatch (CERTCTL_DB_URL → CERTCTL_DATABASE_URL)
- Fix table name mismatches (certificates → managed_certificates, notifications → notification_events)
- Add renewal_policy_id to certificate queries
- Remove non-existent created_at from notification queries
- Add env var fallback for agent CLI flags
- Graceful degradation for missing notifiers/issuers in demo mode
- Copy web/ directory in Dockerfile for dashboard serving

Service layer:
- Implement handler-service interface pattern across all services
- Wire up certificate, agent, job, policy, team, owner, audit, notification services

Documentation:
- Add concepts.md: beginner-friendly guide to TLS, CAs, private keys
- Rewrite quickstart.md with accurate API examples matching actual handlers
- Add demo-advanced.md: interactive demo with cert issuance and automated script
- Update architecture.md with correct table names and connector interfaces
- Update connectors.md to match actual Go interface signatures
- Update demo-guide.md with cross-references to new docs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
shankar0123
2026-03-14 21:38:11 -04:00
parent 3a9fe8ba37
commit 9b4122b159
21 changed files with 1597 additions and 1591 deletions
+13 -6
View File
@@ -34,12 +34,20 @@ func (s *TeamService) List(ctx context.Context, page, perPage int) ([]*domain.Te
perPage = 50
}
offset := int64((page - 1) * perPage)
teams, total, err := s.teamRepo.List(ctx, offset, int64(perPage))
teams, err := s.teamRepo.List(ctx)
if err != nil {
return nil, 0, fmt.Errorf("failed to list teams: %w", err)
}
return teams, total, nil
total := int64(len(teams))
start := (page - 1) * perPage
if start >= int(total) {
return nil, total, nil
}
end := start + perPage
if end > int(total) {
end = int(total)
}
return teams[start:end], total, nil
}
// Get retrieves a team by ID.
@@ -109,13 +117,12 @@ func (s *TeamService) ListTeams(page, perPage int) ([]domain.Team, int64, error)
perPage = 50
}
offset := int64((page - 1) * perPage)
teams, total, err := s.teamRepo.List(context.Background(), offset, int64(perPage))
teams, err := s.teamRepo.List(context.Background())
if err != nil {
return nil, 0, fmt.Errorf("failed to list teams: %w", err)
}
total := int64(len(teams))
// Convert pointers to values for the handler interface
var result []domain.Team
for _, t := range teams {
if t != nil {