diff --git a/.github/workflows/test-unit.yml b/.github/workflows/test-unit.yml index 51fa8c2..f23b7d4 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 @@ -52,12 +52,12 @@ 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 - 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 }} diff --git a/config/default.go b/config/default.go index 5da5f4e..b409ad1 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 3eddab7..698e591 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 {