Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions tools/preconf-rpc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ var (
Value: "mev_oracle",
}

optionPgSSL = &cli.BoolFlag{
Name: "pg-ssl",
Usage: "use SSL for PostgreSQL connection",
EnvVars: []string{"PRECONF_RPC_PG_SSL"},
Value: false,
}

optionL1RPCUrls = &cli.StringSliceFlag{
Name: "l1-rpc-urls",
Usage: "URLs for L1 RPC",
Expand Down Expand Up @@ -221,6 +228,7 @@ func main() {
optionPgUser,
optionPgPassword,
optionPgDbname,
optionPgSSL,
optionLogFmt,
optionLogLevel,
optionLogTags,
Expand Down Expand Up @@ -293,6 +301,7 @@ func main() {
PgUser: c.String(optionPgUser.Name),
PgPassword: c.String(optionPgPassword.Name),
PgDbname: c.String(optionPgDbname.Name),
PgSSL: c.Bool(optionPgSSL.Name),
Logger: logger,
GasTipCap: gasTipCap,
GasFeeCap: gasFeeCap,
Expand Down
9 changes: 7 additions & 2 deletions tools/preconf-rpc/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ type Config struct {
PgUser string
PgPassword string
PgDbname string
PgSSL bool
Signer keysigner.KeySigner
BidderRPC string
AutoDepositAmount *big.Int
Expand Down Expand Up @@ -273,9 +274,13 @@ func (c channelCloser) Close() error {

func initDB(opts *Config) (db *sql.DB, err error) {
// Connection string
sslMode := "disable"
if opts.PgSSL {
sslMode = "require"
}
psqlInfo := fmt.Sprintf(
"host=%s port=%d user=%s password=%s dbname=%s sslmode=disable",
opts.PgHost, opts.PgPort, opts.PgUser, opts.PgPassword, opts.PgDbname,
"host=%s port=%d user=%s password=%s dbname=%s sslmode=%s",
opts.PgHost, opts.PgPort, opts.PgUser, opts.PgPassword, opts.PgDbname, sslMode,
)

// Open a connection
Expand Down
Loading