mirror of
https://github.com/go-shiori/shiori.git
synced 2024-11-10 17:36:02 +08:00
61fbe8fc8c
This fixes an error when the `ENV_SHIORI_DB` is defined, it doesn't open a database file because the database file name isn't on the `databasePath` variable.
29 lines
512 B
Go
29 lines
512 B
Go
//go:generate fileb0x filebox.json
|
|
package main
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/RadhiFadlillah/shiori/cmd"
|
|
db "github.com/RadhiFadlillah/shiori/database"
|
|
_ "github.com/mattn/go-sqlite3"
|
|
)
|
|
|
|
func main() {
|
|
databasePath := "shiori.db"
|
|
if value, found := os.LookupEnv("ENV_SHIORI_DB"); found {
|
|
databasePath = value + "/" + databasePath
|
|
}
|
|
|
|
sqliteDB, err := db.OpenSQLiteDatabase(databasePath)
|
|
checkError(err)
|
|
|
|
cmd.DB = sqliteDB
|
|
cmd.Execute()
|
|
}
|
|
|
|
func checkError(err error) {
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
}
|