mirror of
https://github.com/go-shiori/shiori.git
synced 2025-02-22 23:14:02 +08:00
Add filename if ENV_SHIORI_DB is directory
This commit is contained in:
parent
61fbe8fc8c
commit
c79b117ddb
1 changed files with 7 additions and 1 deletions
8
main.go
8
main.go
|
@ -3,6 +3,7 @@ package main
|
|||
|
||||
import (
|
||||
"os"
|
||||
fp "path/filepath"
|
||||
|
||||
"github.com/RadhiFadlillah/shiori/cmd"
|
||||
db "github.com/RadhiFadlillah/shiori/database"
|
||||
|
@ -12,7 +13,12 @@ import (
|
|||
func main() {
|
||||
databasePath := "shiori.db"
|
||||
if value, found := os.LookupEnv("ENV_SHIORI_DB"); found {
|
||||
databasePath = value + "/" + databasePath
|
||||
// If ENV_SHIORI_DB is directory, append "shiori.db" as filename
|
||||
if f1, err := os.Stat(value); err == nil && f1.IsDir() {
|
||||
value = fp.Join(value, "shiori.db")
|
||||
}
|
||||
|
||||
databasePath = value
|
||||
}
|
||||
|
||||
sqliteDB, err := db.OpenSQLiteDatabase(databasePath)
|
||||
|
|
Loading…
Reference in a new issue