Skip to content
Draft
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
4 changes: 4 additions & 0 deletions clients/pg.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package clients

import (
"context"
"crypto/tls"
"time"

"github.com/go-pg/pg/v10"
Expand Down Expand Up @@ -53,6 +54,9 @@ func NewPostgreSQL(config *viper.Viper, logger *logrus.Logger) *pg.DB {
Password: config.GetString("database.password"),
Database: config.GetString("database.database"),
PoolSize: config.GetInt("database.pool"),
TLSConfig: &tls.Config{
InsecureSkipVerify: true,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ademidov Насколько я понял, рекомендуется еще явно пропихнуть сюда сертификат, чтобы убедиться, что будет использоваться именно он (а не какой-то дефолтный из /etc/ssl/certs/), но это будет выглядеть немного громоздко. Мы с ChatGPT родили такой пример: https://github.com/madatsci/pg-ssl-demo-deprecated/blob/main/go-app/main.go

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

И у меня InsecureSkipVerify: false, чтобы верификация работала.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Возможно я хотел написать эти комментарии к этому ПР – https://github.com/cryptopay-dev/flame/pull/324/files

},
})

if config.GetBool("database.debug") {
Expand Down
2 changes: 1 addition & 1 deletion narada/commands/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func CreateMigration(p *narada.Narada) *cli.Command {

func connect(v *viper.Viper) (*sql.DB, error) {
dsn := fmt.Sprintf(
"postgres://%s:%s@%s/%s?sslmode=disable",
"postgres://%s:%s@%s/%s",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Почему тут вообще отдельный коннект 🤔

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Хотя вижу, так изначально было у Паши

v.GetString("database.user"),
v.GetString("database.password"),
v.GetString("database.addr"),
Expand Down