feat: make watchdog itself configurable
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package database
|
||||
|
||||
import (
|
||||
"eden-server/internal/utility"
|
||||
"orbits-server/internal/utility"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
//var watchdogStop = make(chan struct{})
|
||||
|
||||
func KickoffDatabase(workDir string) (*gorm.DB, error) {
|
||||
dbLoc := filepath.Join(workDir, "garden.db")
|
||||
dbLoc := filepath.Join(workDir, "station.db")
|
||||
db, err := gorm.Open(sqlite.Open(dbLoc), &gorm.Config{
|
||||
Logger: logger.Discard, // disable gorm logging since its not slog (yet)
|
||||
TranslateError: true,
|
||||
@@ -24,7 +24,7 @@ func KickoffDatabase(workDir string) (*gorm.DB, error) {
|
||||
|
||||
// try to use GORM automigrate if the schema changes
|
||||
if err := db.AutoMigrate(
|
||||
&State{},
|
||||
&Command{},
|
||||
&Device{},
|
||||
&File{},
|
||||
); err != nil {
|
||||
@@ -32,8 +32,9 @@ func KickoffDatabase(workDir string) (*gorm.DB, error) {
|
||||
}
|
||||
|
||||
// create the first row if it does not exist yet
|
||||
if err := db.FirstOrCreate(&State{}, State{
|
||||
if err := db.FirstOrCreate(&Command{}, Command{
|
||||
ID: 0,
|
||||
State: "idle",
|
||||
MediaType: Unspecified,
|
||||
}).Error; err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user