diff --git a/main.go b/main.go index 82cfca6..2e2a35c 100644 --- a/main.go +++ b/main.go @@ -14,6 +14,7 @@ func main() { if err != nil { panic(err) } + defer db.Close() handlers := transport.New(db) // Auth endpoints mux.Group(func(mux *flow.Mux) { diff --git a/store/database.go b/store/database.go index 2ed2176..4175c00 100644 --- a/store/database.go +++ b/store/database.go @@ -34,6 +34,7 @@ type Storer interface { SessionUser(token string) (User, error) SaveOauthState(state OauthState) error OauthState(id string) (OauthState, error) + Close() error } type OauthState struct { @@ -349,3 +350,7 @@ func (s *Store) OauthState(id string) (OauthState, error) { } return state, nil } + +func (s *Store) Close() error { + return s.database.Close() +}