Skip to content

Commit

Permalink
Move code
Browse files Browse the repository at this point in the history
Signed-off-by: Maartje Eyskens <[email protected]>
  • Loading branch information
meyskens committed Feb 10, 2021
1 parent 47de10c commit e6cfc2f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions cmd/james/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,6 @@ func (s *serveCmdOptions) RunE(cmd *cobra.Command, args []string) error {
return fmt.Errorf("error creating Discord HA: %w", err)
}

err = dg.Open()
if err != nil {
return fmt.Errorf("error opening connection: %w", err)
}
defer dg.Close()

if s.MongoDBDB != "" {
s.db, err = db.NewMongoDB(s.MongoDBURL, s.MongoDBDB)
if err != nil {
Expand All @@ -124,6 +118,12 @@ func (s *serveCmdOptions) RunE(cmd *cobra.Command, args []string) error {
}
}

err = dg.Open()
if err != nil {
return fmt.Errorf("error opening connection: %w", err)
}
defer dg.Close()

s.RegisterHandlers()

s.ha.AddHandler(s.onMessage)
Expand Down

0 comments on commit e6cfc2f

Please sign in to comment.