Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove manually adding sslmode to connection string #558

Merged
merged 1 commit into from
Jan 23, 2020
Merged
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
6 changes: 2 additions & 4 deletions pkg/scalers/postgres_scaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ func parsePostgresMetadata(resolvedEnv, metadata, authParams map[string]string)
}

if val, ok := authParams["connStr"]; ok {
meta.connStr = val + "?sslmode=disable"
meta.connStr = val
} else if val, ok := metadata["connStr"]; ok {
hostSetting := val

if val, ok := resolvedEnv[hostSetting]; ok {
meta.connStr = val + "?sslmode=disable"
meta.connStr = val
}
} else {
meta.connStr = ""
Expand Down Expand Up @@ -161,13 +161,11 @@ func (s *postGRESScaler) IsActive(ctx context.Context) (bool, error) {

func (s *postGRESScaler) getActiveNumber() (int, error) {
var id int
postgresLog.Info(fmt.Sprintf("Inspecting with query: %s", s.metadata.query))
err := s.connection.QueryRow(s.metadata.query).Scan(&id)
if err != nil {
postgresLog.Error(err, fmt.Sprintf("could not query PG: %s", err))
return 0, fmt.Errorf("could not query PG: %s", err)
}
postgresLog.Info(fmt.Sprintf("Num expected: %d", id))
return id, nil
}

Expand Down