add DB_PATH env

This commit is contained in:
2026-02-13 11:38:17 +03:00
parent 8cf2e69df9
commit 750569986f

View File

@@ -194,7 +194,12 @@ func getPodcastEpisodes(db *sqlx.DB, podcastId int64) ([]*Episode, error) {
func main() {
podcastsDirPath := os.Getenv("PODCASTS_DIRPATH")
db, err := sqlx.Connect("sqlite3", "./db/sqlite.db")
dbPath := os.Getenv("DB_PATH")
if dbPath == "" {
dbPath = "./db/sqlite.db"
}
db, err := sqlx.Connect("sqlite3", dbPath)
if err != nil {
log.Fatalf("failed to connect to db: %v\n", err)
}