Skip to content

Commit

Permalink
split network and user db requires up
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelsc committed Oct 4, 2024
1 parent ae252ae commit dd48a16
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion backend/cmd/misc/commands/app_bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (s *AppBundleCommand) ParseCommandOptions() {

func (s *AppBundleCommand) Requires() misctypes.Requires {
return misctypes.Requires{
DBs: true,
UserDBs: true,
}
}

Expand Down
15 changes: 9 additions & 6 deletions backend/cmd/misc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,12 @@ func Run() {
requires, ok := REQUIRES_LIST[opts.Command]
if !ok {
requires = misctypes.Requires{
Bigtable: true,
Redis: true,
ClNode: true,
ElNode: true,
DBs: true,
Bigtable: true,
Redis: true,
ClNode: true,
ElNode: true,
UserDBs: true,
NetworkDBs: true,
}
}

Expand Down Expand Up @@ -175,7 +176,7 @@ func Run() {
}
}

if requires.DBs {
if requires.NetworkDBs {
db.WriterDb, db.ReaderDb = db.MustInitDB(&types.DatabaseConfig{
Username: cfg.WriterDatabase.Username,
Password: cfg.WriterDatabase.Password,
Expand All @@ -197,6 +198,8 @@ func Run() {
}, "pgx", "postgres")
defer db.ReaderDb.Close()
defer db.WriterDb.Close()
}
if requires.UserDBs {
db.FrontendWriterDB, db.FrontendReaderDB = db.MustInitDB(&types.DatabaseConfig{
Username: cfg.Frontend.WriterDatabase.Username,
Password: cfg.Frontend.WriterDatabase.Password,
Expand Down
11 changes: 6 additions & 5 deletions backend/cmd/misc/misctypes/requires.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package misctypes

type Requires struct {
Bigtable bool
Redis bool
ClNode bool
ElNode bool
DBs bool
Bigtable bool
Redis bool
ClNode bool
ElNode bool
NetworkDBs bool
UserDBs bool
}

0 comments on commit dd48a16

Please sign in to comment.