This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user