add DB_PATH env
This commit is contained in:
7
main.go
7
main.go
@@ -194,7 +194,12 @@ func getPodcastEpisodes(db *sqlx.DB, podcastId int64) ([]*Episode, error) {
|
|||||||
func main() {
|
func main() {
|
||||||
podcastsDirPath := os.Getenv("PODCASTS_DIRPATH")
|
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 {
|
if err != nil {
|
||||||
log.Fatalf("failed to connect to db: %v\n", err)
|
log.Fatalf("failed to connect to db: %v\n", err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user