Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const configFilename = "hal.yaml"
type Config struct {
HomeAssistant HomeAssistantConfig `yaml:"homeAssistant"`
Location LocationConfig `yaml:"location"`
DatabasePath string `yaml:"databasePath"`
}

type HomeAssistantConfig struct {
Expand Down
7 changes: 6 additions & 1 deletion connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ type ConnectionBinder interface {
}

func NewConnection(cfg Config) *Connection {
db, err := store.Open("sqlite.db")
dbPath := cfg.DatabasePath
if dbPath == "" {
dbPath = "sqlite.db"
}

db, err := store.Open(dbPath)
if err != nil {
panic(err)
}
Expand Down
1 change: 1 addition & 0 deletions testutil/testutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ func NewClientServer(t *testing.T) (*hal.Connection, *hassws.Server, func()) {
Token: "test-token",
UserID: TestUserID,
},
DatabasePath: ":memory:",
})

// Create test entity and register it
Expand Down
Loading