shiori/main.go
Abe Estrada 61fbe8fc8c
Prepend environment path to database path
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.
2018-03-05 17:00:07 -07:00

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)
}
}