refactor: migrate env-var reads to config package
This commit is contained in:
@@ -3,7 +3,6 @@ package db
|
||||
import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
// sqlite3 driver.
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
@@ -17,11 +16,3 @@ func Open(dbFile string) (*sql.DB, error) {
|
||||
}
|
||||
return db, nil
|
||||
}
|
||||
|
||||
// GetDBFile returns the database file path, checking DATABASE_FILE env var first
|
||||
func GetDBFile() string {
|
||||
if f := os.Getenv("DATABASE_FILE"); f != "" {
|
||||
return f
|
||||
}
|
||||
return "mal.db"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user