Skip to content

Commit

Permalink
Allow DB override via hidden parameter (#482)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkysel committed Feb 13, 2025
1 parent e8b01a5 commit d911295
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cmd/replication/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,14 @@ func main() {
tracing.GoPanicWrap(ctx, &wg, "main", func(ctx context.Context) {
var dbInstance *sql.DB
if options.Replication.Enable || options.Sync.Enable || options.Indexer.Enable {
namespace := options.DB.NameOverride
if namespace == "" {
namespace = utils.BuildNamespace(options)
}
dbInstance, err = db.NewNamespacedDB(
ctx,
options.DB.WriterConnectionString,
utils.BuildNamespace(options),
namespace,
options.DB.WaitForDB,
options.DB.ReadTimeout,
)
Expand Down
1 change: 1 addition & 0 deletions pkg/config/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type DbOptions struct {
WriteTimeout time.Duration `long:"write-timeout" env:"XMTPD_DB_WRITE_TIMEOUT" description:"Timeout for writing to the database" default:"10s"`
MaxOpenConns int `long:"max-open-conns" env:"XMTPD_DB_MAX_OPEN_CONNS" description:"Maximum number of open connections" default:"80"`
WaitForDB time.Duration `long:"wait-for" env:"XMTPD_DB_WAIT_FOR" description:"wait for DB on start, up to specified duration"`
NameOverride string `long:"name-override" env:"XMTPD_DB_NAME_OVERRIDE" description:"Override the automatically generated DB name" hidden:"true"`
}

type IndexerOptions struct {
Expand Down

0 comments on commit d911295

Please sign in to comment.