no
All checks were successful
Docker Deploy / build-and-push (push) Successful in 1m26s

This commit is contained in:
Atridad Lahiji 2024-11-22 17:34:41 -06:00
parent 025c829c68
commit 3af77b6bea
Signed by: atridad
SSH key fingerprint: SHA256:LGomp8Opq0jz+7kbwNcdfTcuaLRb5Nh0k5AchDDb438
2 changed files with 9 additions and 5 deletions

View file

@ -1,6 +1,5 @@
services:
himbot:
container_name: himbot
server:
image: ${IMAGE}
ports:
- "3117:3000"

View file

@ -18,11 +18,16 @@ var DBConnector *libsql.Connector
func InitDB() error {
// Determine DB path based on /data directory existence
dbName := "file:./himbot.db"
var dbPath string
if _, err := os.Stat("/data"); os.IsNotExist(err) {
dbPath = "file:./himbot.db"
} else {
dbPath = "file:/data/himbot.db"
}
db, err := sql.Open("libsql", dbName)
db, err := sql.Open("libsql", dbPath)
if err != nil {
fmt.Fprintf(os.Stderr, "failed to open db %s", err)
fmt.Fprintf(os.Stderr, "failed to open db %s: %v", dbPath, err)
os.Exit(1)
}