Skip to content

Commit

Permalink
config name standards
Browse files Browse the repository at this point in the history
  • Loading branch information
christophercampbell committed Feb 24, 2025
1 parent 70e1c2e commit 142666e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion config/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Host = "cdk-data-availability-db"
Port = "5432"
EnableLog = false
MaxConns = 200
SslMode = "disable"
SSLMode = "disable"
[RPC]
Host = "0.0.0.0"
Expand Down
6 changes: 3 additions & 3 deletions db/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ type Config struct {
// MaxConns is the maximum number of connections in the pool.
MaxConns int `mapstructure:"MaxConns"`

// SslMode: "require", "verify-full", "verify-ca", and "disable"
SslMode string `mapstructure:"SslMode"`
// SSLMode: "require", "verify-full", "verify-ca", and "disable"
SSLMode string `mapstructure:"SSLMode"`
}

// InitContext initializes DB connection by the given config
func InitContext(ctx context.Context, cfg Config) (*sqlx.DB, error) {
psqlInfo := fmt.Sprintf("host=%s port=%s user=%s password=%s dbname=%s sslmode=%s",
cfg.Host, cfg.Port, cfg.User, cfg.Password, cfg.Name, cfg.SslMode)
cfg.Host, cfg.Port, cfg.User, cfg.Password, cfg.Name, cfg.SSLMode)

conn, err := sqlx.ConnectContext(ctx, "postgres", psqlInfo)
if err != nil {
Expand Down

0 comments on commit 142666e

Please sign in to comment.