switch to postgresql
Some checks failed
CI / test-build (push) Has been cancelled

This commit is contained in:
2025-12-16 01:31:27 +07:00
parent 27b0400ef3
commit a7ba6c83ea
10 changed files with 544 additions and 127 deletions

View File

@@ -26,7 +26,7 @@ type Config struct {
Addr string
TemplatesDir string
StaticDir string
DatabasePath string // Path to SQLite database (empty = in-memory mode)
DatabaseConn string // Database connection string (SQLite path or PostgreSQL connection string, empty = in-memory mode)
}
type App struct {
@@ -103,8 +103,8 @@ func New(cfg Config) (*App, error) {
// Initialize database (optional)
var database *db.DB
if cfg.DatabasePath != "" {
dbConn, err := db.New(cfg.DatabasePath)
if cfg.DatabaseConn != "" {
dbConn, err := db.New(cfg.DatabaseConn)
if err != nil {
return nil, fmt.Errorf("init database: %w", err)
}