feat: migrate templates to embedded filesystem

- Move templates from web/templates/ to webtemplates/templates/
- Replace file-based template loading with Go embed
- Remove external template directory dependency from Dockerfile
- Add webtemplates package with embedded template functionality
- Include comprehensive tests for embedded templates
- Update server initialization to use new embedded template system

This change makes the application self-contained by embedding templates
directly in the binary, eliminating the need for external template files
at runtime.
This commit is contained in:
Benjamin
2025-09-14 21:18:16 +02:00
parent bde1049343
commit c1595ffe3e
12 changed files with 88 additions and 36 deletions
+2 -2
View File
@@ -14,8 +14,8 @@ import (
"github.com/btouchard/ackify-ce/internal/infrastructure/config"
"github.com/btouchard/ackify-ce/internal/infrastructure/database"
"github.com/btouchard/ackify-ce/internal/presentation/handlers"
"github.com/btouchard/ackify-ce/internal/presentation/templates"
"github.com/btouchard/ackify-ce/pkg/crypto"
"github.com/btouchard/ackify-ce/webtemplates"
)
// Server represents the Ackify CE web server
@@ -123,7 +123,7 @@ func initInfrastructure(ctx context.Context) (*config.Config, *sql.DB, *template
}
// Initialize templates
tmpl, err := templates.InitTemplates()
tmpl, err := webtemplates.InitTemplates()
if err != nil {
return nil, nil, nil, nil, fmt.Errorf("failed to initialize templates: %w", err)
}