Skip to content

Commit

Permalink
Change default sslMode to "prefer" (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tvion authored Jan 13, 2025
1 parent 370d84e commit d9cbeb5
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: pgskipper-monitoring-agent
file: Dockerfile
context: ""
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- name: Validate
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/clean.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ env:
jobs:
delete:
if: github.event.ref_type == 'branch'
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- name: Prepare Tag
run: echo "TAG_NAME=$(echo ${TAG_NAME} | sed 's@refs/heads/@@;s@/@_@g')" >> $GITHUB_ENV
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM --platform=$BUILDPLATFORM golang:1.22.5-alpine3.20 as builder
FROM --platform=$BUILDPLATFORM golang:1.22.5-alpine3.20 AS builder

ENV GO111MODULE=on

Expand All @@ -12,8 +12,8 @@ RUN go mod tidy
# Build
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o ./_output/bin/metrics ./collector/main.go

FROM alpine:3.20 as base
COPY --from=builder --chown=${USER_UID} /workspace/_output/bin/metrics /monitor/
FROM alpine:3.20 AS base
COPY --from=builder /workspace/_output/bin/metrics /monitor/

RUN apk add --upgrade --no-cache curl

Expand Down
2 changes: 1 addition & 1 deletion collector/pkg/metrics/ura_collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func handleSourceOfMetric(s *Scraper, parameters map[string]interface{}, paramTy
}

func parseSSLMode(url string) string {
if util.GetEnv("PGSSLMODE", "disable") == "require" {
if util.GetEnv("PGSSLMODE", "prefer") == "require" {
return strings.Replace(url, "http", "https", -1)
}
return url
Expand Down
4 changes: 2 additions & 2 deletions collector/pkg/postgres/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var (
PgUser = util.GetEnv("MONITORING_USER", "monitoring_role")
PgPass = util.GetEnv("MONITORING_PASSWORD", "monitoring_password")
PgDatabase = util.GetEnv("POSTGRES_DATABASE", "postgres")
PgSsl = util.GetEnv("PGSSLMODE", "disable")
PgSsl = util.GetEnv("PGSSLMODE", "prefer")
)

type Row map[string]interface{}
Expand All @@ -57,7 +57,7 @@ func NewConnector() *PostgresConnector {
func NewConnectorForUser(host string, port int, user, pass string) *PostgresConnector {

ssl := false
if PgSsl != "disable" {
if PgSsl == "require" {
ssl = true
}

Expand Down

0 comments on commit d9cbeb5

Please sign in to comment.