feat: configurable db file name

This commit is contained in:
Teajey 2024-12-18 21:27:10 +09:00
parent b471a2e084
commit 7f284d5003
Signed by: Teajey
GPG Key ID: 970E790FE834A713
3 changed files with 3 additions and 2 deletions

2
.gitignore vendored
View File

@ -1,6 +1,6 @@
.DS_Store
gin-bin
lishwist.db
*lishwist.db
.env*.local
server/db/init_sql.go
.ignored/

View File

@ -14,7 +14,7 @@ import (
var database *sql.DB
func Open() error {
db, err := sql.Open("sqlite", "./lishwist.db")
db, err := sql.Open("sqlite", env.DatabaseFile)
if err != nil {
return err
}

1
server/env/env.go vendored
View File

@ -14,6 +14,7 @@ func GuaranteeEnv(key string) (variable string) {
return
}
var DatabaseFile = GuaranteeEnv("LISHWIST_DATABASE_FILE")
var SessionSecret = GuaranteeEnv("LISHWIST_SESSION_SECRET")
var HostRootUrl = GuaranteeEnv("LISHWIST_HOST_ROOT_URL")
var HostPort = os.Getenv("LISHWIST_HOST_PORT")