From 8f40d9b9f8aa8ac61bd7688d2cc425d4b418c226 Mon Sep 17 00:00:00 2001 From: Christopher Campbell Date: Mon, 24 Feb 2025 09:32:39 -0500 Subject: [PATCH 1/5] allow ssl mode to be configured --- config/default.go | 1 + db/config.go | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/config/default.go b/config/default.go index 5da5f4e7..4aa31afb 100644 --- a/config/default.go +++ b/config/default.go @@ -35,6 +35,7 @@ Host = "cdk-data-availability-db" Port = "5432" EnableLog = false MaxConns = 200 +SslMode = "disable" [RPC] Host = "0.0.0.0" diff --git a/db/config.go b/db/config.go index 3eddab71..c632dee4 100644 --- a/db/config.go +++ b/db/config.go @@ -31,12 +31,15 @@ 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"` } // 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=disable", - cfg.Host, cfg.Port, cfg.User, cfg.Password, cfg.Name) + 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) conn, err := sqlx.ConnectContext(ctx, "postgres", psqlInfo) if err != nil { From 5c665f3868f41938a982e465ad7fd8f573653033 Mon Sep 17 00:00:00 2001 From: Christopher Campbell Date: Mon, 24 Feb 2025 09:40:37 -0500 Subject: [PATCH 2/5] upgrade test-unit upload-artifact --- .github/workflows/test-unit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-unit.yml b/.github/workflows/test-unit.yml index 51fa8c26..c4436449 100644 --- a/.github/workflows/test-unit.yml +++ b/.github/workflows/test-unit.yml @@ -35,7 +35,7 @@ jobs: working-directory: test - name: Archive code coverage results - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: code-coverage-report path: test/coverage.out From 70e1c2e97b453b605ec019fddab24cc76f10fec3 Mon Sep 17 00:00:00 2001 From: Christopher Campbell Date: Mon, 24 Feb 2025 09:43:29 -0500 Subject: [PATCH 3/5] upgrade test-unit download-artifact --- .github/workflows/test-unit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-unit.yml b/.github/workflows/test-unit.yml index c4436449..1f27451e 100644 --- a/.github/workflows/test-unit.yml +++ b/.github/workflows/test-unit.yml @@ -52,7 +52,7 @@ jobs: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - name: Download code coverage results - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: code-coverage-report From 142666ec6ab98836c809c48df34943d90d22f0ef Mon Sep 17 00:00:00 2001 From: Christopher Campbell Date: Mon, 24 Feb 2025 09:54:39 -0500 Subject: [PATCH 4/5] config name standards --- config/default.go | 2 +- db/config.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config/default.go b/config/default.go index 4aa31afb..b409ad1d 100644 --- a/config/default.go +++ b/config/default.go @@ -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" diff --git a/db/config.go b/db/config.go index c632dee4..698e591d 100644 --- a/db/config.go +++ b/db/config.go @@ -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 { From a4f77f5c8ead8fc453ff4cfc0ec882983f951148 Mon Sep 17 00:00:00 2001 From: Christopher Campbell Date: Mon, 24 Feb 2025 10:01:14 -0500 Subject: [PATCH 5/5] update sonar scanner action --- .github/workflows/test-unit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-unit.yml b/.github/workflows/test-unit.yml index 1f27451e..f23b7d4a 100644 --- a/.github/workflows/test-unit.yml +++ b/.github/workflows/test-unit.yml @@ -57,7 +57,7 @@ jobs: name: code-coverage-report - name: Analyze with SonarCloud - uses: sonarsource/sonarcloud-github-action@master + uses: sonarsource/sonarqube-scan-action@master env: GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}