Skip to content

Commit 4c97cb9

Browse files
committed
♻️ update db initialization to accept dynamic DB path
1 parent 55ddd03 commit 4c97cb9

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

database/database.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import (
99

1010
var db *sql.DB
1111

12-
func InitDB() {
12+
func InitDB(dbPath string) {
1313
var err error
14-
db, err = sql.Open("sqlite3", "rules.db")
14+
db, err = sql.Open("sqlite3", dbPath)
1515
if err != nil {
1616
logger.Fatal("Failed to open database: %v", err)
1717
}

main.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ func main() {
2323
botGuildID := config.GetEnv("BOT_GUILD_ID", true)
2424
servicesPortsPros := config.GetEnv("SERVICES", true)
2525
deleteCommands := config.GetEnv("DELETE_COMMADS", false) == "true"
26-
adminIDs := config.GetEnv("ADMIN_IDS", false)
26+
adminIDs := config.GetEnv("ADMIN_IDS", true)
27+
dbPath := config.GetEnv("DB_PATH", true)
2728

2829
// Initialize modules
29-
database.InitDB()
30+
database.InitDB(dbPath)
3031
firewall.InitFirewall(servicesPortsPros)
3132
bot.InitBot()
3233
services.InitServices(adminIDs)

0 commit comments

Comments
 (0)