fix: address code review findings
This commit is contained in:
@@ -49,7 +49,7 @@ func main() {
|
||||
cancel()
|
||||
}()
|
||||
|
||||
app, err := NewApp(ctx, cfg)
|
||||
app, err := NewApp(ctx, cfg, "naviwatcher.db")
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to initialize application: %v", err)
|
||||
}
|
||||
@@ -63,9 +63,10 @@ func main() {
|
||||
}
|
||||
|
||||
// NewApp initializes all application components: config, database, and MusicBrainz client.
|
||||
func NewApp(ctx context.Context, cfg *config.Config) (*App, error) {
|
||||
// Initialize database (uses default path or could be made configurable).
|
||||
db, err := database.New("naviwatcher.db")
|
||||
// dbPath is the SQLite database path (use ":memory:" for tests).
|
||||
func NewApp(ctx context.Context, cfg *config.Config, dbPath string) (*App, error) {
|
||||
// Initialize database.
|
||||
db, err := database.New(dbPath)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to initialize database: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user