Merge pull request #46 from AbeEstrada/patch-1

Add filename if ENV_SHIORI_DB is directory
This commit is contained in:
Radhi 2018-03-09 21:19:59 +07:00 committed by GitHub
commit 76fc01f6ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,6 +3,7 @@ package main
import (
"os"
fp "path/filepath"
"github.com/RadhiFadlillah/shiori/cmd"
db "github.com/RadhiFadlillah/shiori/database"
@ -12,6 +13,11 @@ import (
func main() {
databasePath := "shiori.db"
if value, found := os.LookupEnv("ENV_SHIORI_DB"); found {
// 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
}