Skip to content

Commit

Permalink
fix(userservice): init db for reports (#891)
Browse files Browse the repository at this point in the history
BEDS-90
  • Loading branch information
guybrush authored Sep 26, 2024
1 parent 80d2c12 commit 847acff
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions backend/cmd/user_service/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,30 @@ func Run() {
}, "pgx", "postgres")
}()

wg.Add(1)
go func() {
defer wg.Done()
db.WriterDb, db.ReaderDb = db.MustInitDB(&types.DatabaseConfig{
Username: utils.Config.WriterDatabase.Username,
Password: utils.Config.WriterDatabase.Password,
Name: utils.Config.WriterDatabase.Name,
Host: utils.Config.WriterDatabase.Host,
Port: utils.Config.WriterDatabase.Port,
MaxOpenConns: utils.Config.WriterDatabase.MaxOpenConns,
MaxIdleConns: utils.Config.WriterDatabase.MaxIdleConns,
SSL: utils.Config.WriterDatabase.SSL,
}, &types.DatabaseConfig{
Username: utils.Config.ReaderDatabase.Username,
Password: utils.Config.ReaderDatabase.Password,
Name: utils.Config.ReaderDatabase.Name,
Host: utils.Config.ReaderDatabase.Host,
Port: utils.Config.ReaderDatabase.Port,
MaxOpenConns: utils.Config.ReaderDatabase.MaxOpenConns,
MaxIdleConns: utils.Config.ReaderDatabase.MaxIdleConns,
SSL: utils.Config.ReaderDatabase.SSL,
}, "pgx", "postgres")
}()

// if needed, init the database, cache or bigtable

wg.Wait()
Expand Down

0 comments on commit 847acff

Please sign in to comment.